I wants to enable/disable custom command in kendo-ui grid based on some other column. How do i achieve that? Below is sample code@(Html.Kendo().Grid()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(a => a.Name).Width(90);
columns.Bound(a => a.Flag).Width(170);
columns.Command(commands => commands.Custom("ABC").Text("ABC").Click("ABC")).Title ("ABC").Width(130);
...
}
I want to enable/disable ABC command button based on flag value. Please help me
解决方案I solved the problem. Below is the sample code.
columns.Bound(a => a.Flag).ClientTemplate(
"# if(Flag == 'Value1') { #" + "
class='info k-button k-button- icontext' οnclick='clickhere(#=parameter1#)'
value='ClickHere' />" +
"# } else { #" +
"NormalText" +
"# } #").Width(100).Title("ConditionalButton");
//JavaScript
function clickhere(parameter1) {
window.location.href = '@Url.Action("Event", "Home")' +
'?parameter1=' + parameter1;
}