New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
CancelCommand Event
Updated over 6 months ago
Fired when the Cancel button is clicked for an item in the RadGrid control.
Event Parameters
-
(object)sender- The control that fires the event
-
(GridCommandEventArgs)e-
Event arguments
-
(boolean)e.CanceledIf set to True the event will be canceled
-
(object)e.CommandArgumentArguments that are set to the Button's CommandArgument property.
-
(string)e.CommandNameName defined in the CommandName property of the Button.
-
(object)e.CommandSourceThe Control that fired the Command for the Grid.
-
(GridItem)e.ItemGets the Item containing the command source. Can be any of the Grid items that Inherit the
GridItemclass (e.g. GridDataItem, GridCommandItem, GridHeaderItem, GridFilteringItem, GridEditFormItem, etc...)
-
-
Attaching the event
In the Markup
ASP.NET
<telerik:RadGrid ID="RadGrid1" runat="server" OnCancelCommand="RadGrid1_CancelCommand">
</telerik:RadGrid>
In the Code behind
C#
protected void Page_Init(object sender, EventArgs e)
{
RadGrid1.CancelCommand += RadGrid1_CancelCommand;
}The event handler
C#
protected void RadGrid1_CancelCommand(object sender, GridCommandEventArgs e)
{
object commandArguments = e.CommandArgument;
bool canceled = e.Canceled;
string commandName = e.CommandName;
object source = e.CommandSource;
GridItem item = e.Item;
}