ASP.net MVC 4 Panel visible true/false depends on the condition
-
Hi guys, I am beginner in MVC 4, I am facing problem to achieve one simple requirement. The problem described as below. I have 3 roles(Programmer,reviewer,Admin) and 1 razor view, that has 4 panels and each panel has set of controls , depends on the role and the some condition i have to make panels visible false/true. Please help me out. Thanks and regards Vishwa
-
Hi guys, I am beginner in MVC 4, I am facing problem to achieve one simple requirement. The problem described as below. I have 3 roles(Programmer,reviewer,Admin) and 1 razor view, that has 4 panels and each panel has set of controls , depends on the role and the some condition i have to make panels visible false/true. Please help me out. Thanks and regards Vishwa
In the Mvc application we can find ASPNETDB.MDF in Server Explorer. Add roles (Programmer,reviewer,Admin) and its users to respective tables. Now based on the logged-in user's role we can make panel visible property true or false. Sample Code:
if (User.IsInRole("Administrator"))
adminPanel.Visible=True;I hope this will help you. Please accept it as answer if it helped you.
With Regards, Rohith.