Hello,
I’m developing a C#, Asp.Net, MVC 5, EF 6, Code First Web Application in Visual Studio 2013 Pro.
When I put this in a partial view page, the view will not display:
@If(grid.IsAjaxEnabled) { @Html.Label("Ajax is enabled"); } else { @Html.Label("Ajax is NOT enabled"); }
If I take it out, the view displays.
How do you test a Boolean variable in MVC Razor?
Thanks,
Tony
Hi,
Change @If to @if, and your code to be:
@if(grid.IsAjaxEnabled) { @Html.Label("Ajax is enabled"); } else { @Html.Label("Ajax is NOT enabled"); }
Have fun
Hello Jannen.
Thanks for your help. That worked fine.
Thanks,
Tony