473,405 Members | 2,141 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Grid Paging

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?
Nov 18 '05 #1
3 1036
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

"Red" <wr****@redsofttech.com> wrote in message
news:OY**************@TK2MSFTNGP12.phx.gbl...
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?

Nov 18 '05 #2
JG
If you cache it in the session variable, you have to get it from session
variable. You cannot get it from Cache object.

"Red" <wr****@redsofttech.com> wrote in message
news:O1**************@TK2MSFTNGP09.phx.gbl...
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" <wr****@redsofttech.com> wrote in message
news:OY**************@TK2MSFTNGP12.phx.gbl...
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?


Nov 18 '05 #3
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" <JG******@rogers.com> wrote in message
news:3L********************@twister01.bloor.is.net .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" <wr****@redsofttech.com> wrote in message
news:O1**************@TK2MSFTNGP09.phx.gbl...
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" <wr****@redsofttech.com> wrote in message
news:OY**************@TK2MSFTNGP12.phx.gbl...
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?



Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Andrew Banks | last post by:
I've added a data grid to my page but the automatic paging feature doesn't seem to be working. The code I have on page load is as follows. Can anyone suggest why this isn't working? ...
7
by: Brian Henry | last post by:
Hi, I want EnableViewState = false turned on to optimize the end output page (it was over 600KB with it on) but when i turn it off, our pageing functionality no longer works mainly the...
2
by: Joe Au | last post by:
I enable paging on a data grid. But when I click on the page number, nothing happen. Do I have to code something to handle it? Thanks.
4
by: blackhawk | last post by:
I need to build a web page that has to potentially display a large amount of data in two grids on the same page. The HTML file with all of the formatting is about 7MB in size. This is too large...
2
by: Niclas | last post by:
Hi, Is it possible to only show the "Previous Next" paging buttons if the datagrid contains more than the maximum number of items for one page ? Niclas
2
by: serge calderara | last post by:
Dear all, I have an asp net 1.1 application with a datagrid bind to a datasource I am using tablemappings features to display column grids name I am using paging features which shows 10 pages at...
1
by: puja | last post by:
hi all, am using grid view in asp.net 2.0 . My problem is easy but can't get it to work. My grid view id = grdContract and am binding grid view using dataset My dataset returns 5 columns from...
3
by: Logu Krishnan | last post by:
in short, the question is "How do i do custom paging in my asp.net grids" in SQL 2000. if i use default paging and if my db has ~200000 records, then i have to select all the 2 lac records then...
1
by: =?Utf-8?B?TG95b2xhIHN0YWxpbg==?= | last post by:
Hi, I am using ASP.Net 2.0 version and Windows'XP OS. I am useing the Grid view control to display the user details along with the paging concept provided by the grid view control. When i...
2
by: jaredciagar | last post by:
Hi Guys, Please Help ME.... I have a problem in displaying data in my gridview with paging, the data from the database is displaying to my gridview but I want to allow paging in my gridview.how can...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.