PageIndexChanged Event
Fired when one of the page selection elements is clicked.
Event Parameters
-
(object)
sender- The control that fires the event
-
(GridPageChangedEventArgs)
e-
Event arguments that
-
(boolean)
e.CanceledIf set to True the event will be canceled
-
(object)
e.CommandArgumentGets the argument for the command.
-
(string)
e.CommandNameGets the name of the command.
-
(object)
e.CommandSourceGets the source of the commmand
-
(GridItem)
e.ItemGets the item containing the command
-
(int)
e.NewPageIndexGets the new page index the Grid will go on.
-
-
Attaching the event
In the Markup
<telerik:RadGrid ID="RadGrid1" runat="server" OnPageIndexChanged="RadGrid1_PageIndexChanged">
</telerik:RadGrid>
In the Code behind
protected void Page_Init(object sender, EventArgs e)
{
RadGrid1.PageIndexChanged += RadGrid1_PageIndexChanged;
}
Protected Sub Page_Init(sender As Object, e As EventArgs) Handles Me.Init
AddHandler RadGrid1.PageIndexChanged, AddressOf RadGrid1_PageIndexChanged
End Sub
The event handler
protected void RadGrid1_PageIndexChanged(object sender, GridPageChangedEventArgs e)
{
bool canceled = e.Canceled;
object commandArguments = e.CommandArgument;
string commandName = e.CommandName;
object source = e.CommandSource;
GridItem item = e.Item;
int newPageIndex = e.NewPageIndex;
}
Protected Sub RadGrid1_PageIndexChanged(ByVal sender As Object, ByVal e As GridPageChangedEventArgs)
Dim canceled As Boolean = e.Canceled
Dim commandArguments As Object = e.CommandArgument
Dim commandName As String = e.CommandName
Dim source As Object = e.CommandSource
Dim item As GridItem = e.Item
Dim newPageIndex As Integer = e.NewPageIndex
End Sub