all groups > asp.net datagrid control > october 2003 >
You're in the

asp.net datagrid control

group:

datagrid10.aspx sample.


datagrid10.aspx sample. LL
10/30/2003 11:25:44 AM
asp.net datagrid control:
Hi,

I'm testing the QuickStart's datagrid10.aspx. I add paging property to
the grid.

private void MyDataGrid_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{ MyDataGrid.CurrentPageIndex = e.NewPageIndex;
BindGrid();
}

I found that when delte the lastrecord on other page, got this error:


Exception Details: System.Web.HttpException: Invalid CurrentPageIndex value.
It must be >= 0 and < the PageCount.

Source Error:


Line 92:
Line 93: MyDataGrid.DataSource=ds.Tables["Employee"].DefaultView;
Line 94: MyDataGrid.DataBind();
Line 95: }
Line 96:


Source File: c:\project\QS\datagrid10.aspx.cs Line: 94

How to fix it?

Thansk..




Re: datagrid10.aspx sample. Alvin Bruney
11/27/2003 11:10:20 AM
There is no real fix for this. Unless I hear differently, I'm saying this is
a known bug. Just catch the exception and reset the currentpageindex = 0.
That works most of the times.

--
Regards,
Alvin Bruney
Got Tidbits? Get it here
www.networkip.net/tidbits
[quoted text, click to view]

AddThis Social Bookmark Button