I want to disable or enable the button (k-grid-edit, k-grid-add, k-grid-delete) in Kendo Grid base a value (true or false) get from controller (viewbag or viewdata).
That value are got from a function in action base usertype....
I want to disable or enable the button (k-grid-edit, k-grid-add, k-grid-delete) in Kendo Grid base a value (true or false) get from controller (viewbag or viewdata).
That value are got from a function in action base usertype....
columns.Command(command => command.Destroy())
.HtmlAttributes( new { @class = (bool)ViewBag.Disabled ? "k-state-disabled" : "k-state-default"})
Note: You amy have to manually detach the click event of individual buttons for this css trick. Following would be helpful instead:
columns.Command(command => command.Destroy()).Visible((bool)ViewBag.IsDisabled))
or columns.Command(command => command.Destroy()).Hidden((bool)ViewBag.IsDisabled))
For change kendo-grid setting, you must re-create your grid. look here. I hope this could help you.