如何添加到List <list <keyvaluepair <string,string =“”>&gt;&gt;降序</列表<keyvaluepair <串,>

时间:2012-10-23 12:29:55

标签: c# asp.net

我需要在此

中添加多个项目

2 个答案:

答案 0 :(得分: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;
}

答案 1 :(得分: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;
    }