KendoGrid Disable or Enable (edit, add or delete button) base (true or false in )

跟風遠走 提交于 2019-12-11 20:28:55

问题


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


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/19833631/kendogrid-disable-or-enable-edit-add-or-delete-button-base-true-or-false-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!