Edit this page


Sys.CancelEventArgs OnUserAction Property

Generally, RadGrid provides OnCommand event handler, which can be used to cancel every grid command on client-side. Although this would prevent the initiated command to post back to the server, some commands like PageSize, Sorting, etc. also contain client-side logic, e.g. hiding the pager item or changing the status of the sort icon in the header cell of a column. Therefore, we introduced OnUserAction event with the primary goal of providing a convenient way to cancel these actions, which have client-side logic applied in addition to the server-side event raising.

The event will be raised for these actions: Page, Sort, PageSize, Filter. It is commonly used in editing scenarios, to remind the users that they will lose any changes if they continue without saving. You can examine the following live sample for a practical implementation:
Grid - Binding to Telerik ClientDataSource

The event provides arguments to extract details about the user action. Some of the method names depend on the current action due to the specificity of the related argument.

Fired by RadGrid
Arguments Common
get_actionName() - returns the name of the initiated action
get_tableView() - returns the owner Telerik.Web.UI.GridTableView object
set or get_cancel() - gets or sets the cancelled status of the event

set or get_newPageIndex()

set or get_newPageSize()

set or get_sortExpression()

set or get_columnUniqueName() - the name of the column, which the grid will be filtered by
set or get_filterFunction() - the name of the active function: EqualTo, StartsWith, LessThan, etc.
set or get_filterValue() - the value to be filtered on
Can be canceled Yes


    <ClientEvents OnUserAction="userAction" />
function userAction(sender, args) {
    var isDirtyFlag = true; // some condition
    var message = "Changes will be lost. Continue anyway?";

    if (isDirtyFlag && !confirm(message)) {

How to prevent loss of user input in batch editing mode

function OnUserAction(sender, args) {
    var tableView = args.get_tableView();
    var batchEditingManager = sender.get_batchEditingManager();
    var isDirty = batchEditingManager.hasChanges(tableView);
    if (isDirty) {
        var shouldAllowOperation = confirm("changes will be lost, do you wish to continue");