Click here to Skip to main content
12,953,379 members (52,874 online)
Rate this:
Please Sign up or sign in to vote.
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 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 15-Jul-12 5:24am
share your code/project please!!!
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
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 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.

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,429
CHill60 3,490
Maciej Los 3,103
Jochen Arndt 1,975
ppolymorphe 1,930

Advertise | Privacy | Mobile
Web02 | 2.8.170525.1 | Last Updated 27 Nov 2012
Copyright © CodeProject, 1999-2017
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