Hi,
// In Page_Load
uname = Page.User.Identity.Name;// Find the user Role who is logged in
Control admin = Page.FindControl("~/_controls/UC1");
Control user = Page.FindControl("~/_controls/UC2");
if (Roles.IsUserInRole("Admin"))
{
((UserControl)AdminMenu1).Visible = true ;
((UserControl)UserMenu1).Visible = false;
Panel_status.Visible = true;
}
else if (Roles.IsUserInRole("User"))
{
((UserControl)UC1).Visible =false;
((UserControl)UC2).Visible = true;
Panel_status.Visible = false;
}
// In Page_Load
uname = Page.User.Identity.Name;// Find the user Role who is logged in
Control admin = Page.FindControl("~/_controls/UC1");
Control user = Page.FindControl("~/_controls/UC2");
if (Roles.IsUserInRole("Admin"))
{
((UserControl)AdminMenu1).Visible = true ;
((UserControl)UserMenu1).Visible = false;
Panel_status.Visible = true;
}
else if (Roles.IsUserInRole("User"))
{
((UserControl)UC1).Visible =false;
((UserControl)UC2).Visible = true;
Panel_status.Visible = false;
}
No comments:
Post a Comment