ASP.NET面板消失了

时间:2015-08-28 14:36:56

标签: c# asp.net webforms

在我的代码背后,我有以下内容:

public void btnDoSomething_Click(object sender, EventArgs e)                
{
    if (sku.Peso == 0)
    {
        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "Validation", 
          "<script type='text/javascript'>alert('You can't do that!');</script>", false);
        pnlSKU.Style.Remove("visibility");
        pnlSKU.Style.Add("visibility", "visible");
    }
    else 
        //It does something...
         pnlSKU.Style.Remove("visibility");
     pnlSKU.Style.Add("visibility", "visible");
}

在我的aspx中,我在面板pnlSKU中有以下内容:

<asp:Panel ID="pnlSKU" runat="server" Style="visibility: hidden; overflow-x: auto overflow-y: scroll; border-right: black thin solid;
            border-top: black thin solid; z-index: 200; left: 210px; border-left: black thin solid;
            border-bottom: black thin solid; position: absolute; top: 28%; height: 500px;
            background-color: white; width: 900px;">

代码本身的篇幅非常长,但此时并不重要。 每次满足条件时控制面板都会完全消失,即使我调用方法添加到Style属性并将&#34;可见&#34;。

知道为什么会这样吗?

0 个答案:

没有答案