PageSizeChanged Event
Fired when the page size is changed through the advanced pager or manually in code
Event Parameters
-
(object)
sender- The control that fires the event
-
(GridPageSizeChangedEventArgs)
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.NewPageSizeGets the new selected page size that will be applied.
-
-
Attaching the event
In the Markup
<telerik:RadGrid ID="RadGrid1" runat="server" OnPageSizeChanged="RadGrid1_PageSizeChanged">
</telerik:RadGrid>
In the Code behind
protected void Page_Init(object sender, EventArgs e)
{
RadGrid1.PageSizeChanged += RadGrid1_PageSizeChanged;
}
Protected Sub Page_Init(sender As Object, e As EventArgs) Handles Me.Init
AddHandler RadGrid1.PageSizeChanged, AddressOf RadGrid1_PageSizeChanged
End Sub
The event handler
protected void RadGrid1_PageSizeChanged(object sender, GridPageSizeChangedEventArgs e)
{
bool canceled = e.Canceled;
object commandArgs = e.CommandArgument;
string commandName = e.CommandName;
object commandSource = e.CommandSource;
GridItem item = e.Item;
int newPageSize = e.NewPageSize;
}
Protected Sub RadGrid1_PageSizeChanged(ByVal sender As Object, ByVal e As GridPageSizeChangedEventArgs)
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 newPageSize As Integer = e.NewPageSize
End Sub