I have a custom command button in a Client template that I want to fire a specific action. I only want to fire the action. I do not want to redirect/render another View. This is being done inside of a grid hierarchy. Also, the action needs access to my model. Code for the template is below
<
script
id
=
"myTemplate"
type
=
"text/kendo-tmpl"
>
<%: Html.Kendo().Grid<
MyModel
>()
.Name("ThisGrid")
.Columns(columns =>
{
columns.Bound(n => n.value)
.Title("Col1")
.Width(100);
columns.Bound(n => n.IsEnabled)
.Width(100)
.ClientTemplate(
"# if (IsEnabled) { #" +
"Yes" + "#} else {#" +
"No" + "#}#");
columns.Command(command => command.Custom(
"# if(IsEnabled) { #" +
"Disable" +
"#} else { #" +
"Enable" +
"#}#").Click("updateModel")).Width(40);
})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action(
"Binding_Model", "MyController")))
.Pageable()
.Sortable()
.ToClientTemplate()
%>