Live Chat Icon For mobile
Live Chat Icon

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

Share on twitter
Share on facebook
Share on linkedin