Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Grid Paging

Reply
Thread Tools

Grid Paging

 
 
Red
Guest
Posts: n/a
 
      06-29-2004
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?


 
Reply With Quote
 
 
 
 
Red
Guest
Posts: n/a
 
      06-30-2004
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

"Red" <> wrote in message
news:...
> 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?
>
>



 
Reply With Quote
 
 
 
 
JG
Guest
Posts: n/a
 
      06-30-2004
If you cache it in the session variable, you have to get it from session
variable. You cannot get it from Cache object.

"Red" <> wrote in message
news:...
> 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
>
> "Red" <> wrote in message
> news:...
> > 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?
> >
> >

>
>



 
Reply With Quote
 
William
Guest
Posts: n/a
 
      06-30-2004
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.

"JG" <> wrote in message
news:3LpEc.613207$ .cable.rogers.com...
> If you cache it in the session variable, you have to get it from session
> variable. You cannot get it from Cache object.
>
> "Red" <> wrote in message
> news:...
> > 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
> >
> > "Red" <> wrote in message
> > news:...
> > > 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?
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining numeric mode paging and nextPreview paging in datagrid Red ASP .Net 1 03-12-2005 11:41 PM
datagrid paging - customising paging style wh1974 ASP .Net 0 01-12-2005 03:48 PM
DataSet paging vs Datareader paging =?Utf-8?B?UGF0cmljay5PLklnZQ==?= ASP .Net 1 10-08-2004 02:13 PM
Paging Dr. Who, Paging Dr. Who... Father_Sicko@TheOrphanage.com Computer Security 1 07-02-2004 08:59 PM
Please Help - Allow Paging on Grid Properties Builder Eddy Soeparmin ASP .Net 1 07-18-2003 06:58 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57