Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

Grid Paging

 
 
Red
Guest
Posts: n/a
 
      07-01-2004
I am having trouble making the grid paging work. When I first come into the
page the page count is 3. But when I click to go to page 2 and do the
postback the number of pages become 1.

Here is the code in the page load:

'this calls the fill dataset method
If Not IsPostBack Then
FillMessagesGrid()
End If

Her is the FillMessageGrid Method:

Private Sub FillMessagesGrid()
'get the current dataset
DsGetCurrentMessages1 =
DirectCast(MessageServer.GetCurrentMessages().Copy ,
MessagingServices.dsGetCurrentMessages)

'cache the dataset to a session variable
Session("MessageCache") =
DirectCast(Me.DsGetCurrentMessages1.Copy(),
MessagingServices.dsGetCurrentMessages)

'bind the grid to the cached dataset
gridMessages.DataSource = DirectCast(Session("MessageCache"),
MessagingServices.dsGetCurrentMessages)
gridMessages.DataBind()
End Sub

This fills the grid and everything is fine:
Here is my code in the PageIndexChanged Event Handler:

Public Sub PageIndexChanged(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs) Handles gridMessages.PageIndexChanged
Try
gridMessages.CurrentPageIndex = e.NewPageIndex
gridMessages.DataSource = DirectCast(Session("MessageCache"),
MessagingServices.dsGetCurrentMessages)
gridMessages.DataBind()
Catch ex As Exception
Session("CurrentErrorMessage") = gridMessages.PageCount
Session("CurrentErrorPage") = "home.aspx"
Server.Transfer("errorform.aspx")
End Try
End Sub

Please help, this is driving me crazy.

Thank in advance for any help.


 
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