Click here to Skip to main content
Rate this: bad
good
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 17:54pm
mona_12378
Edited 17-Dec-12 19: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 at 18-Dec-12 1:30am
   
Perfect!!my !5+
Abhishek Pant at 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
0 OriginalGriff 278
1 Maciej Los 205
2 DamithSL 193
3 Nguyen.H.H.Dang 190
4 arvind mepani 187


Advertise | Privacy | Mobile
Web03 | 2.8.140709.1 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid