mainrotor
asked on
I need help using viewbag value to hide a column in my Kendo UI grid
Hi Experts,
I have an MVC.Net application with C#.Net code behind.
I want to use a Viewbag value to determine if some columns in my Kendo UI grid should be hidden or not.
below is a snippet of the code I was trying to use, but it does not work.
How can I make this work?
Thanks in advance,
mrotor
I have an MVC.Net application with C#.Net code behind.
I want to use a Viewbag value to determine if some columns in my Kendo UI grid should be hidden or not.
below is a snippet of the code I was trying to use, but it does not work.
How can I make this work?
columns: [
@if(ViewBag.AllowEdit)
{
{
field: "IPA",
title: "IPA",
},
{
field: "TEST",
title: "TEST",
},
}
Thanks in advance,
mrotor
Assuming that you have set ViewData[“AllowEdit”] = true; in the controller method that returns the View, this should work. Please explain what makes you say it doesn’t work?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.