Asp.Net: Databinding a array of strings

You can use a string array as datasource and view the string values by using the Container.DataItem property.

Code example



string[] testData = {"1","two","3","4"};
rptDemo.DataSource = testData;


And in the .aspx:


<asp:Repeater runat="server" ID="rptDemo">
        <%# Container.DataItem %>


Leave a Reply

Your email address will not be published. Required fields are marked *