Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET SQL-Server
Problem with Paging in Gridview in
Hi Friends, This is Rahman.
am working on c#, sqlserver 2005.
am facing problem with Gridview paging.
I have a Gridview on my WEBPAGE. and filled data in it with Paging.
I have thousands of records in gridview. i used to do Paging for it.
when i click on pages 2,3,4... and when i click back to the 1st page it doesnot comes to first page.
this is the problem am facing. Please help me for better solution.
Special thanks.
Posted 14-Jul-12 22:04pm
OriginalGriff at 15-Jul-12 4:26am
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
"It does not come to first page" is not very helpful. Where does it go? Nowhere? Last page? Whst code are you using to page it?
Use the "Improve question" widget to edit your question and provide better information.
Santhosh Kumar J at 15-Jul-12 5:24am
share your code/project please!!!
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

yes sir,
I used gridview Page Index changing Event, and set allow paging properties to true.

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
GridView1.PageIndex = e.NewPageIndex;

Please give me a good solution.
Sandeep Mewara at 16-Jul-12 2:06am
This is not an answer. Please use 'Have a Question or Comment' link to respond to an answer. Use Improve Question link to edit/update your question.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

<asp:gridview id="Gridview1" runat="server" autogeneratecolumns="False" allowpaging="True" onpageindexchanging="Gridview1_PageIndexChanging" xmlns:asp="#unknown"></asp:gridview>
static DataTable dt;//Globally in class

 Gridview1.DataSource = dt;

protected void Gridview1_PageIndexChanging(object sender, GridViewPageEventArgs e)
        Gridview1.PageIndex = e.NewPageIndex;
        Gridview1.DataSource = dt;
This will help you properly

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 490
1 Prakriti Goyal 302
2 Yogesh Kumar Tyagi 224
3 Maciej Los 185
4 Sergey Alexandrovich Kryukov 167
0 OriginalGriff 6,652
1 Sergey Alexandrovich Kryukov 5,449
2 Maciej Los 3,474
3 Peter Leow 3,303
4 DamithSL 2,505

Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 27 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100