'How to use Kendo grid custom command?

I am working on ASP.NET MVC4 application with Kendo UI Grid.

And i want to show custom confirmation message for 'Destroy' command.And for that i am using custom command.

Below is the piece of the code for that :-

<%:Html.Kendo().Grid<Kendo.Mvc.Examples.Models.EmployeeViewModel>()
    .Name("Grid")
    .Columns(columns =>
    {
        columns.Bound(e => e.FirstName);
        columns.Bound(e => e.LastName);
        columns.Bound(e => e.Title);
        columns.Command(command => command.Custom("ViewDetails").Click("showDetails"));
    })
    .DataSource(dataSource => dataSource
        .Ajax()
        .Read(read => read.Action("CustomCommand_Read", "Grid"))
     )
%>

Now,i want to add one method in DataSource before call my "ShowDetails" javascript function(custom command onclick function).

So how can i add my action in DataSource section like - Read,Create,Destory ?



Solution 1:[1]

you can try do this

.Read(read => read.Action("CustomCommand_Read", "Grid").Data("JS_function"))

in this case you call function JS_function and pass parameter that return you this function into your controller action(don't forger add to your CustomCommand_Read parameter)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Std_Net