KendoGrid Disable or Enable (edit, add or delete b

2019-09-05 05:10发布

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....

2条回答
神经病院院长
2楼-- · 2019-09-05 06:00
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))

查看更多
女痞
3楼-- · 2019-09-05 06:05

For change kendo-grid setting, you must re-create your grid. look here. I hope this could help you.

查看更多
登录 后发表回答