TrialUser
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(B yVal sender As Object, ByVal e As System.Web.UI.WebControls. GridViewPa geEventArg s) Handles gvProd.PageIndexChanging
gvProd.PageIndex = e.NewPageIndex
BindGrid()
End Sub
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(B
gvProd.PageIndex = e.NewPageIndex
BindGrid()
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
yeah, but my question is how do I set the sqldatasource' datasource. I pull data into a datatable from a stored procedure.
http://forums.asp.net/p/956540/1177923.aspx#1177923
http://www.aspnettutorials.com/tutorials/controls/pageddatasource-vb.aspx
http://www.4guysfromrolla.com/articles/081804-1.aspx
http://forums.asp.net/p/1573740/4137178.aspx
https://www.experts-exchange.com/questions/24940603/Gridview-Paging-with-SqlDataSource.html
SQLDatasource demo:
http://www.4guysfromrolla.com/articles/110905-1.aspx
http://asp.dotnetheaven.com/aspnet/doc/ctrlref/data/gridview.aspx
please check the above URLs.
Regards,
Raja Muthaiah
http://www.aspnettutorials.com/tutorials/controls/pageddatasource-vb.aspx
http://www.4guysfromrolla.com/articles/081804-1.aspx
http://forums.asp.net/p/1573740/4137178.aspx
https://www.experts-exchange.com/questions/24940603/Gridview-Paging-with-SqlDataSource.html
SQLDatasource demo:
http://www.4guysfromrolla.com/articles/110905-1.aspx
http://asp.dotnetheaven.com/aspnet/doc/ctrlref/data/gridview.aspx
please check the above URLs.
Regards,
Raja Muthaiah
ASKER
thx
Take a look here http://weblogs.asp.net/vikram/archive/2008/04/15/manually-sorting-and-paging-gridview-without-using-datasource-control.aspx