How to fill a DataGrid with an array

Platform: ASP.NET| Category: DataGrid

<asp:DataGrid id='DataGrid1' runat='server'></asp:DataGrid>

VB.NET


Dim strArray As String() = {'Tom', 'Jerry', 'Harry', 'Mickey'}
DataGrid1.DataSource = strArray
DataGrid1.DataBind()

C#


string[] strArray  = {'Tom','Jerry', 'Harry', 'Mickey'};
DataGrid1.DataSource = strArray;
DataGrid1.DataBind();

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.