Wednesday, January 28, 2015

MVC4-Razor: Hide/Show menu item based upon logged in user

Following is the code to check cookie value in MVC and use to manage menu(or any other item) item in CsHTML

@if(Functions.ReadCookie("CookieName")=="1") {
@Html.ActionLink("Admin Users", "Index", "Admin", null, new { @class = Model == "Admin" ? "active" : "" })
}

No comments:

Post a Comment