EditCommand Event
Fired when the Edit 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 Control's CommandName property. (Usually Button but it could be other Control in the Template)
-
(string)
e.CommandNameName defined in the CommandName property of the Control.
-
(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
GridItem
class (e.g. GridDataItem, GridCommandItem, GridHeaderItem, GridFilteringItem, GridEditFormItem, etc...)
-
-
Attaching the event
In the Markup
<telerik:RadGrid ID="RadGrid1" runat="server" OnEditCommand="RadGrid1_EditCommand">
</telerik:RadGrid>
In the Code behind
protected void Page_Init(object sender, EventArgs e)
{
RadGrid1.EditCommand += RadGrid1_EditCommand;
}
Protected Sub Page_Init(sender As Object, e As EventArgs) Handles Me.Init
AddHandler RadGrid1.EditCommand, AddressOf RadGrid1_EditCommand
End Sub
The event handler
protected void RadGrid1_EditCommand(object sender, GridCommandEventArgs e)
{
bool canceled = e.Canceled;
object commandArguments = e.CommandArgument;
string commandName = e.CommandName;
object commandSource = e.CommandSource;
GridItem item = e.Item;
}
Protected Sub RadGrid1_EditCommand(ByVal sender As Object, ByVal e As GridCommandEventArgs)
Dim commandArguments As Object = e.CommandArgument
Dim canceled As Boolean = e.Canceled
Dim commandName As String = e.CommandName
Dim source As Object = e.CommandSource
Dim item As GridItem = e.Item
End Sub