I am using Kendo ui grid in asp.net MVC. Is it possible to hide/show grid column based on user role? Thanks
2 Answers
10
votes
4
votes
You can specify if a column is visible using hidden, so one option may be to set a variable based on the users role. For example, in the controller
ViewBag.CanDisplay = true; // or omit if the user does not have permission
and in the view
var canDisplay = '@ViewBag.CanDisplay' | false;
$("#grid").kendoGrid({
columns: [
{ field: "firstProperty" },
{ field: "anotherProperty", hidden: !canDisplay }
],