Click here to Skip to main content
Sign Up to vote bad
good
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:54
mona_12353
Edited 17 Dec '12 - 19:25


4 solutions

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  
Comments
AshishChaudha - 18 Dec '12 - 1:30
Perfect!!my !5+
Abhishek Pant - 18 Dec '12 - 1:55
thanks
Pagination for gird view[^]
 
Check this link
  Permalink  
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  
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
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 514
1 CPallini 245
2 Mahesh Bailwal 244
3 Maciej Los 240
4 Aarti Meswania 213
0 Sergey Alexandrovich Kryukov 9,162
1 OriginalGriff 7,179
2 CPallini 3,913
3 Rohan Leuva 3,176
4 Maciej Los 2,588


Advertise | Privacy | Mobile
Web02 | 2.6.130516.1 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid