System.Web.UI.WebControls Namespace GridView Class
.NET Framework version 2.0
Sets or retrieves the number of records to display on a single page of a GridView control.
Inline |
<asp:gridview pagesize = intSize ... > |
Script |
GridView.PageSize = intSize |
intSize |
Integer specifying the number of rows to display on a single page of the GridView control. |
The property is read/write with a default value of 10.
Use this property to specify the number of rows to display on a single page of the GridView control. The AllowPaging property must be set to true for this property have any effect.
The following example demonstrates how to programmatically set the PageSize property to specify how many rows are displayed on a single page of the GridView control at run time, based on user input.
void bindGrid ( ) {
myGrid.PageSize = int.Parse ( numPages.SelectedItem.Text );
string query = "SELECT * FROM pubs_Titles";
myGrid.DataSource = fetchData ( query, "pubs" );
myGrid.DataBind ( );
}
Sub bindGrid ( )
myGrid.PageSize = Integer.Parse ( numPages.SelectedItem.Text )
Dim query As String = "SELECT * FROM pubs_Titles"
myGrid.DataSource = fetchData ( query, "pubs" )
myGrid.DataBind ( )
End Sub |
|
C# |
VB |
GridView Members AllowPaging PageCount PageIndex PageIndexChanging