Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Dynamic columns in DataGrid, Paging/Sorting and Data Caching

Reply
Thread Tools

Dynamic columns in DataGrid, Paging/Sorting and Data Caching

 
 
Kostia
Guest
Posts: n/a
 
      04-16-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable page caching without disabling caching of jpegs andstylesheets etc JimLad ASP .Net 3 01-21-2010 10:13 AM
database columns vs. gui columns and sorting ittay.dror@gmail.com Java 5 03-04-2006 10:48 AM
convert rows to columns and columns to rows helpful sql ASP .Net 0 05-19-2005 06:03 PM
Fragment Caching inside page caching? Troy Simpson ASP .Net 0 01-19-2004 11:57 AM
trouble with caching or caching the trouble Hypo ASP .Net 6 08-01-2003 07:11 AM



Advertisments