Created
February 26, 2022 12:02
-
-
Save corespider/fd74db44242eb97326d0c6da2b39e16e to your computer and use it in GitHub Desktop.
How to Bind Array to GridView in ASP.Net
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Tow Dimensional Array | |
string[,] arr2D = { | |
{ "Ram", "India" }, | |
{ "John", "USA" }, | |
{ "Stewart", "UK" }, | |
{ "Sham", "India"}, | |
{ "Tod","USA" }, | |
{ "Bryan","Russia" } | |
}; | |
ArrayList arrList = new ArrayList(); | |
for (int i = 0; i < 5; i++) | |
{ | |
arrList.Add(new ListItem(arr2D[i, 0], arr2D[i, 1])); | |
} | |
gridView2.DataSource = arrList; | |
gridView2.DataBind(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment