If you want to allow paging in a ASP .NET 2.0 GridView that uses a LLBLGEN datasource:

– set AllowPaging = True

image

image

– Create the PageIndexChanging event

/// <summary>
/// Change the page of the GridViewKlanten
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void GridViewKlanten_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    GridViewKlanten.PageIndex = e.NewPageIndex;
    GridviewKlantenBind();
}
       /// <summary>
       /// Get klanten from database and bind to GridView
       /// </summary>
       private void GridviewKlantenBind()
       {
           KlantComponent klantcompent = new KlantComponent(_logger);
           GridViewKlanten.DataSource = klantcompent.GetKlanten();
           GridViewKlanten.DataBind();
       }
 
Don't forget to rebind the GridView or you will not see any change.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.