New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

Get the RadGrid Data Item in the Client-Side OnCommand Event

Updated on Nov 2, 2026

Environment

ProductTelerik UI for ASP.NET AJAX
Version2026.3.811

Description

The client-side OnCommand event does not expose the clicked button or a CommandSource property. For Edit and Delete commands, the command argument contains the item index. You can use that index with the client-side table view to retrieve the corresponding data item when the grid uses client-side binding.

Solution

Register a client-side OnCommand handler and use get_commandArgument() to retrieve the item index. Then retrieve the item from get_dataItems() and call get_dataItem().

JavaScript
function onCommand(sender, args) {
    var commandName = args.get_commandName();

    if (commandName == "Edit" || commandName == "Delete") {
        var itemIndex = args.get_commandArgument();
        var dataItems = args.get_tableView().get_dataItems();
        var dataItem = dataItems[itemIndex].get_dataItem();

        console.log(dataItem);
    }
}

The command argument is an item index, not the clicked button element. If you need the button itself, handle its click separately and resolve the parent row from the DOM. The server-side CommandSource and Item properties do not have client-side equivalents in OnCommand.

For the event API and client-side event registration, see OnCommand.

See Also