Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ASP.NET面板消失_C#_Asp.net_Webforms - Fatal编程技术网

C# ASP.NET面板消失

C# ASP.NET面板消失,c#,asp.net,webforms,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/j

在我的代码隐藏中,我有以下内容:

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");
}
public void btndo\u单击(对象发送者,事件参数e)
{
如果(sku.Peso==0)
{
ScriptManager.RegisterStartupScript(this.Page,this.Page.GetType(),“验证”,
“警惕('你不能那样做!');”,错);
pnlSKU.Style.Remove(“可见性”);
添加(“可见性”、“可见”);
}
其他的
//它做了些什么。。。
pnlSKU.Style.Remove(“可见性”);
添加(“可见性”、“可见”);
}
在我的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;">

代码本身要长得多,但这并不重要。 每次满足条件时,控制面板完全消失,即使我调用方法add to the Style属性并放置“visible”


知道为什么会发生吗?

问题:为什么不直接使用pnlSKU.Visible=true?在该设置的快速测试中,按下按钮时会出现面板。因此,肯定还有其他css在起作用。使用google开发者工具或firebug来识别隐藏面板的css规则。我可以在控制面板上方看到以下内容
这可能是罪魁祸首吗?我不管理CSS,引导等很好。。。然而,我发现了问题,HashPsi为我指出了正确的方向,在这个例子中有一个css规则叫做mpSKU,它看起来像默认值一样隐藏。因此,检查后面的代码时,我添加了mpSKU.Show();在条件中,while为true。这是阿贾克斯吗?