18 March, 2009
0 Comments
0 categories
If you want to allow paging in a ASP .NET 2.0 GridView that uses a LLBLGEN datasource:
– set AllowPaging = True
– 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.