This documentation is archived and is not being maintained.

DataGrid.CurrentPageIndex Property

Gets or sets the index of the currently displayed page.

[Visual Basic]
Public Property CurrentPageIndex As Integer
public int CurrentPageIndex {get; set;}
public: __property int get_CurrentPageIndex();
public: __property void set_CurrentPageIndex(int);
public function get CurrentPageIndex() : int;
public function set CurrentPageIndex(int);

Property Value

The index of the page currently displayed.


Exception Type Condition
ArgumentOutOfRangeException The specified page index is a negative value.


Use this property to determine the currently displayed page in the DataGrid control when paging is enabled. This property is also used to programmatically control which page is displayed.

You can also hide the built in paging controls and create custom controls. To display a specific page, set this property to the page index you want to display and then rebind the data to the DataGrid control.

Note   The CurrentPageIndex property is zero based.


Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

DataGrid Class | DataGrid Members | System.Web.UI.WebControls Namespace | AllowPaging | AllowCustomPaging