Link to home
Start Free TrialLog in
Avatar of mainrotor
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?

columns: [
@if(ViewBag.AllowEdit)
{
        {   
             field: "IPA",
             title: "IPA",
         },
        {
             field: "TEST",
             title: "TEST",
        },
}

Open in new window



Thanks in advance,
mrotor
Avatar of Kelvin McDaniel
Kelvin McDaniel
Flag of United States of America image

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
Avatar of louisfr
louisfr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial