• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 300
  • Last Modified:

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

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

how do you use the grdTemplateTrack_PageIndexChanging and grdTemplateTrack_SelectedIndexChanged?

  • 2
1 Solution
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.
chuang4630Author Commented:
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?
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now