我在 formview 中有一个 sqldatasourcece 控件和 formview 控件,我有一个不可见的占位符。如果文本框(在同一个表单视图内)的值为“是”,我想让占位符可见。
<asp:TextBox ID="Load_SystemsTextBox" runat="server"
Text='<%# Bind("Load_Systems") %>' />
<asp:PlaceHolder ID="PlaceHolderItem3Yes" runat="server" Visible="False">
the value returned from the database equals yes
</asp:PlaceHolder>
我正在尝试使占位符在后面的 cobe 中可见,但以下剂量有效
PlaceHolder PlaceHolderItem3Yes = (PlaceHolder)Master.FindControl("PlaceHolderItem3Yes");
TextBox Load_SystemsTextBox = (TextBox)FormView2.FindControl("Load_SystemsTextBox");
if (Load_SystemsTextBox.Text == "YES")
{
PlaceHolderItem2Yes.Visible = true;
}
else
{
PlaceHolderItem2Yes.Visible = false;
}