How to handle the page view in GridView (ASP.NET 2.0) control?

Posted on 2006-06-05
Last Modified: 2008-02-01
How to handle the page view in GridView (ASP.NET 2.0) control?

how do you use the grdTemplateTrack_PageIndexChanging and grdTemplateTrack_SelectedIndexChanged?

Question by:chuang4630
    LVL 5

    Expert Comment

    What are you wanting to do? Grid view has built in pageing (no code needed, unlike the datagrid). Simpy set Allowpaging.


    Anything ending in "ing" is usually pre event.
    And ending in "ed" is post even.

    So pre paging and post paging. These events always fire on  a page change.  So you could do custom if you wanted.

    You can also set the page manually.

    Gridview-> page index =1 or what ever.
    LVL 1

    Author Comment

    I ran the test with 20 rows of data. There is no  problem to display the first 10 rows. However, when I click the page 2, the page does not change. So I am wondering what may go wrong.

    The code to display the data is in If (!IsPostback) clause. No ode outside this clause.

    Also, I am windering whether the page change happens n the server or client side?
    LVL 5

    Accepted Solution

    Sorry, on late respond.
     Its sever side.
     So if you got 50,000  rows at 10 a page. The client only gets 10, which is good since sending 50, 000 rows would really hurt performance.

    Check out this site for gridview help.

    Im not a 100% sure but I think you need to rebind on every page request. So move databind out og your if not postback and see if that helps.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
    IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now