-2

我需要在其中添加多个项目

4

2 回答 2

1

对这个问题的直接回答是:是的,这是可能的。

间接反应:

<asp:Label ID="lblTest" runat="server" Text="This is a test"></asp:Label>

//Check weather the condition matches
if("this" != "That")
{
    //If not, it will hide the label.
    lblTest.Visible = false;
}
于 2012-10-23T12:32:02.137 回答
0

是的,用户控件可以有条件地隐藏/显示。这是一个更完整的示例:

<uc1:UC1 ID="userControl1" runat="server" Visible="false" />
<uc1:uc2 ID="userControl2" runat="server" Visible="false" />
<uc1:uc3 ID="userControl3" runat="server" Visible="false" />

    protected void Page_Load(object sender, EventArgs e)
    {
        if (something = "a")
            userControl1.Visible = true;
        else if (something = "b")
            userControl2.Visible = true;
        else
            userControl3.Visible = true;
    }
于 2012-10-23T12:43:59.887 回答