Aug 25, 2010, 2:46 PM
Populating GridPanel at runtime, no erros are displayed but GridPanel remains empty
Hi folks, I added a GridPanel to the page and with a direct event a wrote the following function that I pass a DataTable, which doesn't throw any error but the GridPanel doesn't show anything as well even though there are rows on the DataTable.
Can you help me identify the problem?
Can you help me identify the problem?
private void RenderGrid(DataTable Data)
{
for (int i = 0; i < Data.Columns.Count; i++)
{
gridResults2.ColumnModel.Columns.Add(new Column() { ColumnID = Data.Columns[i].ColumnName, Header = Data.Columns[i].ColumnName, DataIndex = Data.Columns[i].ColumnName });
}
Store store = new Store();
store.DataSource = Data;
JsonReader jsonReader = new JsonReader();
for (int i = 0; i < Data.Columns.Count; i++)
{
jsonReader.Fields.Add(Data.Columns[i].ColumnName);
}
store.Reader.Add(jsonReader);
gridResults2.Store.Clear();
gridResults2.Store.Add(store);
gridResults2.Reconfigure();
gridResults2.DataBind();
}