Databind on Paging
Posted on 2010-11-09
Protected Sub BindGrid()
gvProd.DataSource = dtSource
I have a gridview that is databound to a datatable. I have set the allowpaging property to true .
I have pasted the code I have for paging below. however when I click on the Page 2 button, there is no records displayed becasue the datatable's value is nothing. I am wondering if I need to get the datatable from viewstate afer the user clicks on Page 2? Please suggest. thanks
Protected Sub gvProd_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles gvProd.PageIndexChanging
gvProd.PageIndex = e.NewPageIndex