Grid Paging

R

Red

I have implemented the PageIndexChanged event handler and also cached the
data source to a session object. Everytime I click on the next page I get a:

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

The page index is 1, the number of pages is 2. Any ideas?
 
R

Red

OK, now I can get it to page, but there is no data. Now I know when the
initial grid displays it shows 3 pages. I have cached the data to the cahe
object. Here is the code from my PageIndexChanged event handler:

#Region " Message Grid Page Index Changed Event Handler "

Public Sub PageIndexChanged(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs) Handles gridMessages.PageIndexChanged

Try

gridMessages.CurrentPageIndex = e.NewPageIndex

'gridMessages.DataSource = DirectCast(Cache.Get("MessageDataset"),
MessagingServices.dsGetCurrentMessages)

gridMessages.DataBind()

Catch ex As Exception

Session("CurrentErrorMessage") = gridMessages.PageCount

Session("CurrentErrorPage") = "home.aspx"

Server.Transfer("errorform.aspx")

End Try

End Sub

#End Region
 
J

JG

If you cache it in the session variable, you have to get it from session
variable. You cannot get it from Cache object.
 
W

William

I actually changed that so that it was saved to the cache object instead of
the session object. As I said it pages but when it returns it has no data.
Just so I understand when you page it IS doing a postback correct? This may
be my issue.
 

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,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top