Search

You searched for the word(s): userid:644222

Matching Posts

  • Re: HOW TO: Using sorting / paging on GridView w/o a DataSourceControl DataSource

    I added the following code: lblSearchResults.Text = gvResults.DataSource.GetType().ToString(); DataTable table = gvResults.DataSource as DataTable ; if (table == null ) { lblSearchResults.Text = lblSearchResults.Text + " TABLE STILL CAME BACK NULL" ; } It blew up when attempting to GetType saying "Object reference not set to an instance of an object.". No matter though, I saved the table to cache after initially populating the grid which works well. When I call the sort I look for the cached table
  • Re: HOW TO: Using sorting / paging on GridView w/o a DataSourceControl DataSource

    Can you please explain a little further. I used a DataTable to bind to my grid. gvResults.DataSource = ds.Tables[0]; gvResults.DataBind(); That worked fine, however the only way I was able to make the sort work using your example I had to hold onto the datasource via ViewState ViewState["gvResults_DataSource"] = gvResults.DataSource; After having done that I was able to modify the first line of the sorting routine to DataTable dt = (DataTable)ViewState["gvResults_DataSource"]; The sort worked after
Page 1 of 1 (2 items)