這是我的代碼,,,
protected void Page_Load(object sender, EventArgs e)
{
if (Session[ "UserID "] <> null)
{
Button2.Visible = "false ";
Button3.Visible = "false ";
Button4.Visible = "false ";
}
else
{
Button2.Visible = true;
Button3.Visible = true;
Button4.Visible = true;
}
}
------解决方案--------------------------------------------------------
if (Session[ "UserID "] != null && Session[ "UserID "].ToString()!= " ")
{
Button2.Visible = false;
Button3.Visible = false;
Button4.Visible = false;
}
else
{
Button2.Visible = true;
Button3.Visible = true;
Button4.Visible = true;
}