Wierd DataGrid behaviour

S

Simon

Guys,

I have a datagrid that has paging, with the below code.

It _used_ to work, but now doesn't. No idea why.
However, if I put code breaks on the lines indicated with
*, I get the following results:

..DataBind: PageCount = 16, CurrentPageIndex = 2
..Write: PageCount = 1, CurrentPageIndex = 2

So, calling databind results in 15 pages disappearing, and
then this error:

"Invalid CurrentPageIndex value. It must be >= 0 and < the
PageCount."

Any ideas?

Simon.



private void DataGrid1_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
System.Data.DataView dvData =
(System.Data.DataView)Session["myData"];
DataGrid1.DataSource = dvData ;
DataGrid1.CurrentPageIndex = e.NewPageIndex;
try
{
* DataGrid1.DataBind();
}
catch
{
* Response.Write("error");
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top