当特定用户登录网站时,我必须隐藏第4列。这是我目前的asp和c#代码:
protected void Page_Load(object sender, EventArgs e)
{
((LoggedIn)Page.Master).CurrentPage = LoggedIn.LoggedInMenuPages.1;
if (CurrentCustomer.AdminRole==false)
{
******NEED TO HIDE ITEM 4
}
}
答案 0 :(得分:0)
将runat="server"
添加到元素以及特定ID
,之后进入Page_Load
写ControlID.Visible=false
<强> ASPX 强>
<li id="AdminElement" runat="server">
//other tags
</li>
<强>的Page_Load 强>
AdminElement.Visible = CurrentCustomer.AdminRole;
//remove the class attribute from the aspx
AdminElement.Attributes["class"] = GetCurrentPageStyle("4");