In my ASP.NET MVC project, I have this code in a view:
[...]
<%if(item.IsActive)
{
Html.ActionLink("Deactivate", "ChangeVisibility", new { id = item.Id, val = false }, new { @class = "activate-manipulate-news" });
}
else
{
Html.ActionLink("Activate", "ChangeVisibility", new { id = item.Id, val = true }, new { @class = "activate-manipulate-news" });
}
%>
I’m trying to figure out, why that code nothing renders in the output. The controller and the ChangeVisibility is implemented.
The if else sytax should be something like below.
I never worked on this syntax, but I googled for if else syntax in asp.net mvc and found this link which explains the syntax difference between MVC2 and MVC3 razon syntax. http://www.csharpcity.com/ifelse-statements-in-mvc3-with-razor/