Invalid CurrentPageIndex value

J

jm

I get this error when I click one of the datagrids pages:

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

It is not doing this on the submit as I have this:

Sub submit(Source As Object, e As EventArgs)
if page.IsValid then
MyDataGrid.CurrentPageIndex = 0
BindData()
end if
End Sub

This is the OnPageIndexChanged="NewPage" event handler

Sub NewPage(sender As Object, e As DataGridPageChangedEventArgs)
response.write("before: " & MyDataGrid.currentpageindex & ", ")
MyDataGrid.CurrentPageIndex = e.NewPageIndex
response.write("new: " & e.NewPageIndex & ", current: ")
response.write(MyDataGrid.CurrentPageIndex)
BindData() 'goes to another sub that does the SQL
End Sub

The response.write reveals the page indices are correct.

ANY ideas? Thanks in advance. I've about had it with the DataGrid control!
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top