Controls You Can Use on Web Forms ASP.NET Data Controls GridView Control
The GridView Web server control enables paging thru the data in the grid using any of the following methods:
- Default paging using built-in paging controls
- Default paging using custom navigation controls
- Custom paging
- Set the control’s AllowPaging property to true.
- Optionally set the PageSize property to the number of rows to display per page. If not specified, defaults to 10 rows per page.
<asp:GridView id="myGrid" runat="server"
datasourceid="customers"
allowpaging=true
...
>
or simply
<asp:GridView id="myGrid" runat="server"
datasourceid="customers"
allowpaging
...
>
The GridView control includes properties for customizing the default pager style.
- Within the GridView declaration, declare a <
PagerSettings
> element.
- Within the PagerSettings element, define each of the properties you intend to customize. For syntax, see GridView Control Syntax.
<pagersettings
mode="nextprevious"
nextpagetext="Next"
previouspagetext="Back"
position="top"
pagebuttoncount=10 />
- Also within the GridView declaration, declare a <
PagerStyle
> element.
- Within the PagerStyle element, define each of the properties you intend to customize. For syntax, see GridView Control Syntax.
<pagerstyle
backcolor="steelblue"
forecolor="beige"
horizontalalign="right" />