Wednesday, August 18, 2010

How to page a gridview in vb.net?

I know how to page threw a datagrid i use the folowing code





Protected Sub grid_PageIndexChanged(ByVal sender As System.Object, ByVal e As DataGridPageChangedEventArgs) Handles grid.PageIndexChanged


mygrid.CurrentPageIndex = e.NewPageIndex


mygrid.DataSource = mydataset


mygrid.DataBind()


End Sub





but how do i page a gridview. The event that handles paging does not like


mygrid.mypageindex


how do i change the code for the datagird to work for a dataview?How to page a gridview in vb.net?
check out http://www.pscode.com for great examples.How to page a gridview in vb.net?
The GridView makes paging even easier with its AllowPaging attribute. This attribute can be set either by adding the attribute to the GridView control in HTML mode or by checking the Enable Paging checkbox in the GridView’s smart tag. Enabling paging in the GridView control defaults to a page size of 10records and adds the Pager to the bottom of the grid.








%26lt;asp:GridView ID=”GridView1” Runat=”server” DataSourceID=”SqlDataSource1”


DataKeyNames=”CustomerID” AutoGenerateColumns=”False”


AllowSorting=”True” AllowPaging=”True”%26gt;








Thank You.

No comments:

Post a Comment