hiding buttons in master page
- by pankaj
Hi,
I am working on an app where i am having some linkbuttons in master page.
I want to display them depending upon the authorization given to them once they logs in. I have initially made all of them visible false and then i am checking the authorisation in the aspx.cs class of master page. I make the link button visible depending upon the right granted to the user. But it is making all the link buttons visible. Instead it should only make two of them visible and rest should be hidden. Following is my code from MasterPage.aspx.cs:
ArrayList arrlstUserRoles = new ArrayList();
arrlstUserRoles = (ArrayList)Session["Roles"];
for (int j = 0; j < arrlstUserRoles.Count; j++)
{
if (int.Parse(arrlstUserRoles[j].ToString()) == 1)
{
lbtnRetailer.Visible = true;
}
else if (int.Parse(arrlstUserRoles[j].ToString()) == 2)
{
lbtnCategory.Visible = true;
}
else if (int.Parse(arrlstUserRoles[j].ToString()) == 3)
{
lbtnCouponTemplate.Visible = true;
}
else if (int.Parse(arrlstUserRoles[j].ToString()) == 4)
{
//lbtnStoreManagement.Visible = true;
}
else if (int.Parse(arrlstUserRoles[j].ToString()) == 5)
{
lbtnStoreManagement.Visible = true;
}
else if (int.Parse(arrlstUserRoles[j].ToString()) == 6)
{
lbtnContentManagement.Visible = true;
}
else if (int.Parse(arrlstUserRoles[j].ToString()) == 7)
{
//lbtnStoreManagement.Visible = true;
}
}