Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET 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 16th, 2004, 07:56 AM
Registered User
Join Date: Dec 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default pagging in asp.net datagrid

hi guys

i have done pagging in asp.net datagrid, and it is working perfectly
my code is here,

Private Sub BindGrid()
        Dim cnn As SqlConnection
        Dim da As SqlDataAdapter
        Dim ds As New DataSet()

        cnn = New SqlConnection(ConfigurationSettings.AppSettings(). Item("ConnectionString"))
        da = New SqlDataAdapter("select lastname,firstname,city from employees", cnn)
        da.Fill(ds, "employees")

        DataGrid1.DataSource = ds
        DataGrid1.DataMember = "employees"

    End Sub

    Private Sub DataGrid1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataGrid1.SelectedIndexChanged

    End Sub

    Private Sub DataGrid1_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles DataGrid1.PageIndexChanged
        DataGrid1.CurrentPageIndex = e.NewPageIndex
    End Sub

but now what i m thinking is that if i have 50 pages then i have to call bindgrid() from datagrid1_pageindexchanged() 50 times.so bindgrid() function has code to connect with sql server, so what happen , it will connect everytime with server then get dataset and then bind datagrid? plz if u know what happen plz explain me , and if i m right then what about speed?


Old December 17th, 2004, 03:14 AM
Friend of Wrox
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76

You are not going through all the pages. You only go through certain pages.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pagging Sheraz Khan ASP.NET 2.0 Professional 2 October 17th, 2007 07:04 AM
how pagging can be done in jsp kirtesh4u JSP Basics 1 May 29th, 2007 04:54 AM
vb.net asp.net DataGrid krantips VS.NET 2002/2003 0 June 28th, 2006 01:22 AM
ASP.NET datagrid marclena VS.NET 2002/2003 2 November 4th, 2003 11:02 AM

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