Hide and visible the div tags of Layout.cshtml on the basis of user role in Asp.net MVC4(Razor) -
i having master page having menus role called user , other menus role of admin, willing check role of user , and show div tags , hide others on basis of user role.
as, don't have controller layout.cshtml, how can set viewmodel layout view wherein can check role of current user
how role based checking on layout.cshtml.
i have been through followin question has not been answered now
how show or hide controls based on roles - asp.net mvc 4 razor
so,please tell me possible solution , way best applying role based checking in layout.cshtml
you use user.isinrole
method:
@if (user.isinrole("admin")) { <li>only admin can see menu item</li> }
Comments
Post a Comment