Paging a datagrid

F

Fabiano

Please,

i've created a datagrid that allow numbered paging.
But when i click over a page that must be called, i get this error:

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

at my page, on Paging Event i'm using the commands bellow:

private void DataGrid1_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
DataGrid1.DataBind();
}



I get the error at the DataBind function. what could be wrong?



Tks

Fabiano
 
J

Jonel Rienton

Fabiano said:
Please,

i've created a datagrid that allow numbered paging.
But when i click over a page that must be called, i get this error:

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

at my page, on Paging Event i'm using the commands bellow:

private void DataGrid1_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
DataGrid1.DataBind();
}



I get the error at the DataBind function. what could be wrong?



Tks

Fabiano

Fabiano,

Check to make sure the datagrid is indeed being rendered again during
the postback. Maybe your datasource object is not being populated during
the postback as well.

regards,
Jonel
 

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

Similar Threads

DataGrid Paging 0
Invalid Index in paging 3
Paging DataGrid 0
Wierd DataGrid behaviour 0
DataGrid - Paging problems 1
Error in Paging 1
Still having problems with the CurrentPageIndex 0
How to Page a DataGrid 0

Members online

No members online now.

Forum statistics

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

Latest Threads

Top