Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果 a 中的文本为“已关闭”,如何设置Panel对象的可见性?falseTextBox
Panel
false
TextBox
我目前的代码是:
if (Session["txtALTN1"] != "Closed") { pnlALTN1.Visible = false; } else { pnlALTN1.Visible = true; }
控件没有放置在会话中,如果 txtALTN1 是您的 TextBox,请改用:
if (txtALTN1.Text != "Closed") { pnlALTN1.Visible = false; } else { pnlALTN1.Visible = true; }
或者简单地说:
pnlALTN1.Visible = (txtALTN1.Text == "Closed");