Click here to Skip to main content
12,699,351 members (32,968 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: ASP.NET
I want to allow paging for the gridview. I have set PagerSettings properties to the gridview. Also i have created event of OnPageIndexChanging...

Here is my code..,

protected void GrdATGmailContact_PageIndexChanging(object sender,GridViewPageEventArgs e)
{
    GrdATGmailContact.PageIndex = e.NewPageIndex;
    GrdATGmailContact.DataBind();
}


But when i click on next button. It wont display grid. What should I do to correct this error??
Posted 17-Dec-12 18:54pm
mona_12384
Updated 17-Dec-12 20:25pm
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

ASP.NET Enhanced Grid View with Custom Pagination[^]
paging in asp.net gridview[^]
Pagination Class for ASP.NET MVC[^]

Pagination In Grid veiw Without passing paging parameters in Stored Procedure In ASP.net[^]

Quote:
Set the Gridview's properties AllowPaging="true" and pagesize="10"

or
Quote:
set gridview property AllowPaging="true" ;
and In page index changing event
protected void GrdATGmailContact_PageIndexChanging(object sender, GridViewPageEventArgs e)
       {
            GrdATGmailContact.PageIndex = e.NewPageIndex;
            FillGrid();//method to bind grid
        }




hope it helped.
  Permalink  
v2
Comments
AshishChaudha 18-Dec-12 1:30am
   
Perfect!!my !5+
Abhishek Pant 18-Dec-12 1:55am
   
thanks
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Pagination for gird view[^]

Check this link
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Effective Paging with GridView Control in ASP.NET[^]

Set allowpaging property of grid view to true
In pageindex changing event write the following code
gridview1.pageindex=e.newpageindex;
gridview1.databind();
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

You have to set Gridview's Property Allowpaging=true

In code you have written a code in pageindexchanging.

gridview1.pageindex=e.newpageindex;
gridview1.databind();


In above code you are missing the datasource for Gridview, or you can call the same function which you have used to fill the Gridview.



gridview1.pageindex=e.newpageindex;
//Code for fill datatable or dataset
gridview1.datasource=dt;
gridview1.databind();



Thanks
  Permalink  

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


Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 18 Dec 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