禁用asp.net中的面板

时间:2013-11-18 09:21:22

标签: c# asp.net

我想在asp.net中禁用面板,就像经理登录那样他们无法看到主管 还有经理和主管指定也在表格中定义,如

1 supervisor
2  manager

我试试这个,但我试试这个,但我不工作

if (Session["UserDesignation"].ToString() == "2")
{
    Manager.Visible = true;
}
else
{
    Manager.Visible = false;
}
if (Session["UserDesignation"].ToString() == "1")
{
    SuperVisiorPanel.Visible = true;
}
else
{
    SuperVisiorPanel.Visible = false;
}

并以登录表格

int desginid = Convert.ToInt16(aa.spdesign(txt_username.Value, txt_pass.Value));
Session["UserDesignationID"] = desginid;

if (users == 1)
{
    Session["Login2"] = txt_username.Value;
    Session["Login3"] = txt_pass.Value;
    Session["UserDesignationID"] =  desginid;
    Session["UserTypeID"] = users;

    Response.Redirect("AdminOp.aspx");
}
else if (users == 2)
{
    Session["Login2"] = txt_username.Value;
    Session["Login3"] = txt_pass.Value;
    Session["UserDesignationID"] = desginid;

    Session["UserTypeID"] = users;

    Response.Redirect("upload.aspx");
}

这里是1,代码是用户类型ID

任何帮助?

1 个答案:

答案 0 :(得分:1)

启用/禁用asp.net面板

SuperVisiorPanel.Enabled = false;
SuperVisiorPanel.Enabled = True;

隐藏/显示asp.net面板

SuperVisiorPanel.Visible = false;
SuperVisiorPanel.Visible = True;