DataGridPageChangedEventArgs(Object, Int32) 构造函数

定义

初始化 DataGridPageChangedEventArgs 类的新实例。Initializes a new instance of the DataGridPageChangedEventArgs class.

public:
 DataGridPageChangedEventArgs(System::Object ^ commandSource, int newPageIndex);
public DataGridPageChangedEventArgs (object commandSource, int newPageIndex);
new System.Web.UI.WebControls.DataGridPageChangedEventArgs : obj * int -> System.Web.UI.WebControls.DataGridPageChangedEventArgs
Public Sub New (commandSource As Object, newPageIndex As Integer)

参数

commandSource
Object

命令源。The source of the command.

newPageIndex
Int32

用户从 DataGrid 控件的页选择元素选定的页的索引。The index of the page selected by the user from the page selection element of the DataGrid control.

示例

下面的代码示例演示如何创建和初始化DataGridPageChangedEventArgs类的新实例。The following code example demonstrates how to create and initialize a new instance of the DataGridPageChangedEventArgs class.

void Grid_Change(Object sender, DataGridPageChangedEventArgs e) 
{
   DataGridPageChangedEventArgs page_change_args = new DataGridPageChangedEventArgs(e.CommandSource, e.NewPageIndex);
}
   
Sub Grid_Change(sender As Object, e As DataGridPageChangedEventArgs)
    Dim page_change_args As New DataGridPageChangedEventArgs(e.CommandSource, e.NewPageIndex)
End Sub

注解

使用此构造函数创建并初始化DataGridPageChangedEventArgs类的新实例。Use this constructor to create and initialize a new instance of the DataGridPageChangedEventArgs class.

当通过调用此DataGridCommandEventArgs构造函数创建的实例时, 以下属性将初始化为指定值。When an instance of DataGridCommandEventArgs is created by a call to this constructor, the following properties are initialized to the specified values.

属性Properties 初始值Initial value
CommandSource commandSource 参数。The commandSource parameter.
NewPageIndex newPageIndex 参数。The newPageIndex parameter.

适用于