K
Kostia
Hi,
I have a DataGrid that has no columns and that is populated with
columns based on data obtained from DB during PageLoad in the
following way:
//reset adapter and datatable mapping
oleDbDataAdapter.TableMappings.Clear();
System.Data.Common.DataTableMapping tableMap =
oleDbDataAdapter.TableMappings.Add("Table", "SummaryData");
// create each column in the table
BoundColumn col = new BoundColumn();
col.HeaderText=columnsInfo["displayName"].ToString();
col.DataField=columnsInfo["columnName"].ToString().;
SumOutTable.Columns.Add(col);
tableMap.ColumnMappings.Add(new
System.Data.Common.DataColumnMapping(colstr, colstr));
oleDbDataAdapter.Fill(dsSummaryData);
Cache["SummaryResults"]=dsSummaryData;
SumOutTable.DataSource = dsSummaryData;
SumOutTable.DataBind();
onpageindexchanged is called when page is changed and here it is:
protected virtual void OnPageIndexChanged(Object sender,
DataGridPageChangedEventArgs
e)
{
// Set CurrentPageIndex to the page the user clicked.
SumOutTable.CurrentPageIndex = e.NewPageIndex;
// Rebind the data to refresh the DataGrid control.
SumOutTable.DataSource = (DataSet)Cache["SummaryResults"];
SumOutTable.DataBind();
}
It seems that Data is there and there are no exceptions however the
page of the datagrid contains no data and no columns?
Does it have anything to do with columns being added dynamically?
How do I solve this problem? Anything that could be said about sorting
and possible problems I will run into there?
Kostia
I have a DataGrid that has no columns and that is populated with
columns based on data obtained from DB during PageLoad in the
following way:
//reset adapter and datatable mapping
oleDbDataAdapter.TableMappings.Clear();
System.Data.Common.DataTableMapping tableMap =
oleDbDataAdapter.TableMappings.Add("Table", "SummaryData");
// create each column in the table
BoundColumn col = new BoundColumn();
col.HeaderText=columnsInfo["displayName"].ToString();
col.DataField=columnsInfo["columnName"].ToString().;
SumOutTable.Columns.Add(col);
tableMap.ColumnMappings.Add(new
System.Data.Common.DataColumnMapping(colstr, colstr));
oleDbDataAdapter.Fill(dsSummaryData);
Cache["SummaryResults"]=dsSummaryData;
SumOutTable.DataSource = dsSummaryData;
SumOutTable.DataBind();
onpageindexchanged is called when page is changed and here it is:
protected virtual void OnPageIndexChanged(Object sender,
DataGridPageChangedEventArgs
e)
{
// Set CurrentPageIndex to the page the user clicked.
SumOutTable.CurrentPageIndex = e.NewPageIndex;
// Rebind the data to refresh the DataGrid control.
SumOutTable.DataSource = (DataSet)Cache["SummaryResults"];
SumOutTable.DataBind();
}
It seems that Data is there and there are no exceptions however the
page of the datagrid contains no data and no columns?
Does it have anything to do with columns being added dynamically?
How do I solve this problem? Anything that could be said about sorting
and possible problems I will run into there?
Kostia