Wrox Programmer Forums
|
.NET Framework 2.0 For discussion of the Microsoft .NET Framework 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Framework 2.0 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 December 23rd, 2004, 04:40 AM
Registered User
 
Join Date: Dec 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with datagrid help

i have a dtagrid that take the source from a stored procedure acording to data in a dropdownlist
now my problem is that i tried to allow paging for the datagrid but when i'm in the third page i can't return to the second page it returns to the first page
my code is
in pageload With dg
            dg.AllowPaging = True
            dg.PagerStyle.Mode = PagerMode.NumericPages
            dg.PagerStyle.PageButtonCount = 2
            dg.PageSize = 2
            dg.DataSource = dsUpcour
            dg.ShowHeader = True
            dg.Visible = True
            dg.DataBind()
        End With
in Private Sub dg_PageIndexChanged(ByVal source As Object, _
 ByVal e As System.Web.UI.WebControls.DataGridPageChangedEvent Args) _
 Handles dg.PageIndexChanged
        dg.CurrentPageIndex = e.NewPageIndex
        dg.DataBind()
        dg.CurrentPageIndex = 0/*to avoid this error Invalid current pageIndex value. It must be >= 0 and < the PageCount. */

    End Sub

 
Old January 3rd, 2005, 06:40 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

You are setting PageIndex = 0 ,that could be the reason.. or Check in store procedure for the start and end values to fetch the records.

 
Old January 3rd, 2005, 07:39 AM
Registered User
 
Join Date: Dec 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thank you, but can you explain more please

 
Old January 5th, 2005, 05:26 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

You are using dsUpcour stored procedure to bind the Values to the Grid.For each page,you might be fetching only the set of records from the database.Like if you showing 10 records per page,you might have written to fetch 1(start) to 10(end) records for first page and for second page 11 to 20.. I was asking you to check whether you have manipulated correctly for start and end.


 
Old January 5th, 2005, 05:30 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

If you still didnt find solution check out the samples in this link..
http://samples.gotdotnet.com/quickst..._datagrid.aspx

 
Old January 12th, 2005, 08:47 AM
Registered User
 
Join Date: Dec 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks alote but i think that i have to apply the custom paging instead of default becouse the data source is a stored procedure






Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with datagrid Shishir ASP.NET 1.0 and 1.1 Professional 1 January 6th, 2007 09:01 AM
Datagrid Problem monika.vasvani ASP.NET 1.0 and 1.1 Professional 1 December 5th, 2006 03:09 AM
DataGrid Problem anujrathi VB.NET 2002/2003 Basics 2 June 15th, 2006 02:18 AM
DataGrid Problem anujrathi ASP.NET 2.0 Basics 1 June 12th, 2006 03:52 PM
Datagrid problem dotnetprogrammer VS.NET 2002/2003 1 February 17th, 2005 05:11 AM





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