RadControls for ASP.NET AJAX Telerik.Web.UI.GridCommandEventArgs OnCommand Property
Note |
|---|
To get or set property values for client API properties, you must call property
accessor methods that are named with the get_ and set_ prefixes. For example, to get or set a
value for a property such as cancel,
you call the get_cancel or set_cancel.
|
This event will be raised for each grid command which is about to be triggered (sorting, paging, filtering, editing, etc.) before postback/ajax request except hierarchy/grouping expand/collapse action. The event can be intercepted in order to perform a certain operation in the grid via web service or to detect what type of command is raised on the client.
Fired by | RadGrid |
Arguments | commandName - the name of the command which is about to be processed
commandArgument - the command argument(s) value(s)
tableView - returns reference to the owner TableView
|
Can be canceled | Yes, set eventArgs.set_cancel(true) to cancel |
Example:
CopyASPX
<telerik:RadGrid ID="RadGrid1" runat="server">
<ClientSettings>
<ClientEvents OnCommand="RaiseCommand" />
</ClientSettings>
</telerik:RadGrid>
CopyJavaScript
function RaiseCommand(sender, eventArgs)
{
var result = String.format("CommandName: {0}, CommandArgument: {1}", eventArgs.get_commandName(), eventArgs.get_commandArgument());
if (<some_custom_condition_not_met>)
{
eventArgs.set_cancel(true);
}
}