Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 20th, 2006, 12:49 PM
Authorized User
 
Join Date: Mar 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Paging of Datagrid cannot work

In my datagrid i had set the paging to it. When the record go to next page, i cannot view it by click the next button, it keep on show me the 1st page record.
How to solve this problem? Thanks.
I use SqlDataAdapter and Dataset to bind the data into datagrid
da.Fill(ds)
DataGrid1.DataSource = ds
DataGrid1.DataBind()

 
Old March 20th, 2006, 01:47 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Do you have a method setup to handle paging?? For example, setting the # of records to be displayed does not enable paging you need to set up a method to handle this:

    Private Sub dgPageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles [datagrid].PageIndexChanged
        [datagrid].CurrentPageIndex = e.NewPageIndex
        [datagrid].datasource = [source]
        [datagrid].DataBind()
    End Sub

Hope that helps.

"The one language all programmers understand is profanity."
 
Old March 20th, 2006, 07:28 PM
Authorized User
 
Join Date: Mar 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

dparsons, [datagrid].datasource = [source], the source here is refer to?
Thanks.

 
Old March 20th, 2006, 07:43 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

[source] refers to your Datasource, in your example your dataset.

"The one language all programmers understand is profanity."
 
Old March 20th, 2006, 11:38 PM
Authorized User
 
Join Date: Mar 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Is that mean that i need to do this:
Sub DataGrid1_PageIndexChanged(sender As Object, e As DataGridPageChangedEventArgs)
DataGrid1.CurrentPageIndex = e.NewPageIndex
DataGrid1.DataBind()
End Sub
Thanks

 
Old March 21st, 2006, 07:29 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

You need to do:
Sub DataGrid1_PageIndexChanged(....) HANDLES datagrid1.PageIndexChanged

End Sub


"The one language all programmers understand is profanity."





Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom paging in Datagrid with datagrid page count madhusrp ASP.NET 1.0 and 1.1 Professional 12 June 2nd, 2008 01:15 PM
Paging in DataGrid vijay_83 ASP.NET 2.0 Professional 0 September 29th, 2006 02:02 PM
DataGrid Paging nsrujan C# 0 February 6th, 2006 09:12 AM
Paging in datagrid Renu ASP.NET 1.0 and 1.1 Basics 2 September 9th, 2004 01:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.