嗨如何根據thier登錄類型來隱藏特定用戶的特定菜單...我有一個母版頁......如何隱藏特定用戶的菜單?
1)I have four Main users
2)Each user is redirected his own page on login.
我想是我想隱藏的所有用戶一些菜單基於thier登錄類型
1)if Manager logins only his required menu should be shown to him,this menu shouldn't be avaliable to other users
我登錄的代碼是這樣的
protected void btnLogin_Click(object sender, EventArgs e)
{
//Response.Redirect("~//Administration/DashBoard.aspx");
SqlConnection con = new SqlConnection("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DebitCareBankApp;Data Source=SSDEV7-HP\\SQLEXPRESS");
string cmdStr = "select LoginType from Login where UserName='" + TxtUserName.Text + "' AND Password = '" + TxtPassword.Text + "'";
SqlCommand cmd = new SqlCommand(cmdStr, con);
con.Open();
Object TypeUser = cmd.ExecuteScalar();
con.Close();
//int switchcase = int.Parse(TypeUser);
if (TypeUser != null)
{
LblError.Visible = false;
LblError.Text = "";
if (TypeUser.ToString() == "Manager")
{
Response.Redirect("~//Administration/Manager/WorkManagement.aspx");
}
else if (TypeUser.ToString() == "HR")
{
Response.Redirect("~//Administration/Hr/CalculateAndGeneratePayslips.aspx");
}
else if (TypeUser.ToString() == "Employee")
{
Response.Redirect("~//Administration/CallingAgent/TodaysWork.aspx");
}
}
else
{
LblError.Visible = true;
LblError.Text = "Invalid Credentials Entered, Try again";
}
}
你是如何建立你的菜單?您是使用UserControl來做到這一點,還是在每個頁面中手動建立菜單? – 2012-02-13 13:18:50