-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
GridViewPageEventArgs.xml
146 lines (123 loc) · 9.68 KB
/
GridViewPageEventArgs.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<Type Name="GridViewPageEventArgs" FullName="System.Web.UI.WebControls.GridViewPageEventArgs">
<TypeSignature Language="C#" Value="public class GridViewPageEventArgs : System.ComponentModel.CancelEventArgs" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit GridViewPageEventArgs extends System.ComponentModel.CancelEventArgs" />
<TypeSignature Language="DocId" Value="T:System.Web.UI.WebControls.GridViewPageEventArgs" />
<TypeSignature Language="VB.NET" Value="Public Class GridViewPageEventArgs
Inherits CancelEventArgs" />
<TypeSignature Language="F#" Value="type GridViewPageEventArgs = class
 inherit CancelEventArgs" />
<TypeSignature Language="C++ CLI" Value="public ref class GridViewPageEventArgs : System::ComponentModel::CancelEventArgs" />
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.ComponentModel.CancelEventArgs</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Provides data for the <see cref="E:System.Web.UI.WebControls.GridView.PageIndexChanging" /> event.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Web.UI.WebControls.GridView> control raises the <xref:System.Web.UI.WebControls.GridView.PageIndexChanging> event when a pager button (a button with its `CommandName` property set to "Page") within the control is clicked, but before the <xref:System.Web.UI.WebControls.GridView> control handles the paging operation. This allows you to provide an event-handling method that performs a custom routine, such as canceling the paging operation, whenever this event occurs.
> [!NOTE]
> Pager buttons are usually located in the pager row of a <xref:System.Web.UI.WebControls.GridView> control.
A <xref:System.Web.UI.WebControls.GridViewPageEventArgs> object is passed to the event-handling method, which allows you to determine the index of the page selected by the user and to indicate that the paging operation should be canceled. To cancel the paging operation, set the <xref:System.ComponentModel.CancelEventArgs.Cancel%2A?displayProperty=nameWithType> property of the <xref:System.Web.UI.WebControls.GridViewPageEventArgs> object to `true`.
For more information about how to handle events, see [Handling and Raising Events](/dotnet/standard/events/).
For a list of initial property values for an instance of <xref:System.Web.UI.WebControls.GridViewPageEventArgs>, see the <xref:System.Web.UI.WebControls.GridViewPageEventArgs.%23ctor%2A> constructor.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.GridViewPageEventArgs> object passed to the event-handling method to determine the index of the page selected by the user and to cancel the paging operation.
:::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/GridViewPageIndexChanging/CS/gridviewpageindexchangingcs.aspx" id="Snippet1":::
:::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/GridViewPageIndexChanging/VB/gridviewpageindexchangingvb.aspx" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.GridView" />
<altmember cref="T:System.Web.UI.WebControls.GridViewPageEventHandler" />
<altmember cref="E:System.Web.UI.WebControls.GridView.PageIndexChanging" />
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public GridViewPageEventArgs (int newPageIndex);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(int32 newPageIndex) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.GridViewPageEventArgs.#ctor(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (newPageIndex As Integer)" />
<MemberSignature Language="F#" Value="new System.Web.UI.WebControls.GridViewPageEventArgs : int -> System.Web.UI.WebControls.GridViewPageEventArgs" Usage="new System.Web.UI.WebControls.GridViewPageEventArgs newPageIndex" />
<MemberSignature Language="C++ CLI" Value="public:
 GridViewPageEventArgs(int newPageIndex);" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="newPageIndex" Type="System.Int32" />
</Parameters>
<Docs>
<param name="newPageIndex">The index of the new page to display.</param>
<summary>Initializes a new instance of the <see cref="T:System.Web.UI.WebControls.GridViewPageEventArgs" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this constructor to initialize a new instance of the <xref:System.Web.UI.WebControls.GridViewPageEventArgs> class.
The following table shows the initial property value for an instance of <xref:System.Web.UI.WebControls.GridViewPageEventArgs>.
|Property|Initial value|
|--------------|-------------------|
|<xref:System.Web.UI.WebControls.GridViewPageEventArgs.NewPageIndex%2A>|The value of the `newPageIndex` parameter.|
> [!NOTE]
> This constructor is used primarily by control developers when raising events.
]]></format>
</remarks>
<altmember cref="P:System.Web.UI.WebControls.GridViewPageEventArgs.NewPageIndex" />
</Docs>
</Member>
<Member MemberName="NewPageIndex">
<MemberSignature Language="C#" Value="public int NewPageIndex { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 NewPageIndex" />
<MemberSignature Language="DocId" Value="P:System.Web.UI.WebControls.GridViewPageEventArgs.NewPageIndex" />
<MemberSignature Language="VB.NET" Value="Public Property NewPageIndex As Integer" />
<MemberSignature Language="F#" Value="member this.NewPageIndex : int with get, set" Usage="System.Web.UI.WebControls.GridViewPageEventArgs.NewPageIndex" />
<MemberSignature Language="C++ CLI" Value="public:
 property int NewPageIndex { int get(); void set(int value); };" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the index of the new page to display in the <see cref="T:System.Web.UI.WebControls.GridView" /> control.</summary>
<value>The index of the new page to display in the <see cref="T:System.Web.UI.WebControls.GridView" /> control.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Because the <xref:System.Web.UI.WebControls.GridView.PageIndexChanging> event occurs before the <xref:System.Web.UI.WebControls.GridView> control performs the paging operation, the <xref:System.Web.UI.WebControls.GridView.PageIndex%2A> property of the control cannot be used to determine the index of the page selected by the user. Use the <xref:System.Web.UI.WebControls.GridViewPageEventArgs.NewPageIndex%2A> property to determine the index of the page selected by the user.
> [!NOTE]
> During the <xref:System.Web.UI.WebControls.GridView.PageIndexChanging> event, the <xref:System.Web.UI.WebControls.GridView.PageIndex%2A> property still contains the index of the previously displayed page.
You can also use this property to programmatically override the page index selected by the user by setting it to another value.
## Examples
The following example demonstrates how to use the <xref:System.Web.UI.WebControls.GridViewPageEventArgs.NewPageIndex%2A> property to determine the index of the page selected by the user.
:::code language="aspx-csharp" source="~/snippets/csharp/VS_Snippets_WebNet/GridViewPageIndexChanging/CS/gridviewpageindexchangingcs.aspx" id="Snippet1":::
:::code language="aspx-vb" source="~/snippets/visualbasic/VS_Snippets_WebNet/GridViewPageIndexChanging/VB/gridviewpageindexchangingvb.aspx" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The <see cref="P:System.Web.UI.WebControls.GridViewPageEventArgs.NewPageIndex" /> property is less than zero.</exception>
<altmember cref="P:System.Web.UI.WebControls.GridView.PageIndex" />
<altmember cref="E:System.Web.UI.WebControls.GridView.PageIndexChanging" />
</Docs>
</Member>
</Members>
</Type>