ASP.NET - paging in gridview seemoreitems instead of numbers

Asked By msakt on 28-Jun-12 01:02 AM
paging in gridview show seemoreitems..

first bind 10 per page..in footer show seemoreitems..if click here another 10 records bind
S K replied to msakt on 28-Jun-12 01:11 AM
There are lots of good stuff on internet for paging example in gridview in asp.net
Some of these are good 
http://www.codeproject.com/Articles/410733/Custom-paging-with-ASP-NET-GridView 
http://msdn.microsoft.com/en-us/library/aa479347.aspx 

the concept are same only you can display your choice setting based on your requierment means you can put "SeeMoreItems" instead of next button caption etc.

hope this helps you
Vikram Singh Saini replied to msakt on 28-Jun-12 01:42 AM
Hi,

The paging concept in gridview has been provided for this very reason. Yes! The first ten records (or whatever set by developer) are bind to gridview while displaying records in page.

When you click on next page number, then next 10 records are binded to gridview. The gridview works in this way for optimum performance. You can use custom paging in Pager template within gridview as:

<PagerTemplate>
 <asp:LinkButton ID="hlNext" Text="See more items" OnClick="hlNext_Click" />
</PagerTemplate>


And in code-behind file:

protected void hlNext_Click(object sender, EventArgs e)
{
     // Get the current page selected
      int CurIndex = GridView1.PageIndex;
     
     // Increment index by 1
      GridView1.PageIndex = CurIndex + 1;

      // Populate your grid
      GridView1.DataSourceID = "adsUploadedFiles";
      GridView1.DataBind();
}