I needed to dynamically generate data for a GridView, so I built a DataTable to store the data. When I tried to bind the DataTable to GridView, there's nothing displayed on the GridView. I tried debugging and verified that data are being stored into the DataTable correctly.
There is no code on the aspx side, just a gridview.
// C# code
DataTable dt = new DataTable();
dt.Columns.Add(new DataColumn("C1", typeof(string)));
dt.Columns.Add(new DataColumn("C2", typeof(string)));
dt.Columns.Add(new DataColumn("C3", typeof(string)));
DataRow dr = dt.NewRow();
dr["C1"] = "11";
dr["C2"] = "22";
dr["C3"] = "33";
dt.Rows.Add(dr);
GridView2.DataSource = dt;
GridView2.DataBind();