Link to home
Start Free TrialLog in
Avatar of TrialUser
TrialUserFlag for Afghanistan

asked on

Databind on Paging

Protected Sub BindGrid()
        gvProd.DataSource = dtSource
        gvProd.DataBind()
    End Sub

   
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
        BindGrid()



    End Sub
ASKER CERTIFIED SOLUTION
Avatar of devlab2012
devlab2012
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of TrialUser

ASKER

yeah, but my question is how do I set the sqldatasource' datasource. I pull data into a datatable from a stored procedure.
thx