面板可见=真不起作用 [英] Panel visible=true has no effect

查看:131
本文介绍了面板可见=真不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小组,我设置可见=真实明确。调试器越过这条线和可见仍计算为False下一行。显然,作为一个结果,小组不显示。这怎么可能?

I have a Panel that I'm setting visible=true explicitly. The debugger passes over that line and visible still evaluates to False on the next line. Obviously as a result, the Panel is not shown. How is this possible?

pnlValidate.Visible = true;
if (IsPostBack) return;

<asp:Panel ID="pnlValidate" runat="server">
    <asp:Button cssclass="submit2" ID="btnValidate" runat="server" Visible="false" text="Validate" OnClick="btnValidate_Click" /> <br />
    <asp:TextBox ID="txt6sql" runat="server" Visible="false" TextMode="multiLine" Width="500" Height="200" ReadOnly="true" ToolTip="Report SQL Statement" />
</asp:Panel>

ASP.NET 2.0,没有其他的线程或靠不住erratta认为应该与我的会员搞乱。

ASP.NET 2.0, no other threads or wonky erratta that "should" be messing with my members.

推荐答案

嵌套在另一个面板或任何其他类型的容器已可见设置为false内部的面板?

Is your panel nested inside another panel or any other type of container which has Visible set to false?

对于这样的情况下你所观察到的行为是可再现。这将是有意义禁止能见度设置为true内部容器如果外部容器是看不见的,因为这意味着里面什么也没有必须是可见的,甚至没有内板的空div。

For such a situation the behaviour your observed is reproducable. It would make sense to forbid to set visibility to true for the inner container if an outer container is invisible since that means nothing inside must be visible, even not the empty div of the inner panel.

Visible属性似乎是依赖于外容器的知名度,如:

The Visible property seems to be dependent on the visibility of outer containers, for instance:

<asp:Panel ID="Panel0" runat="server" Visible="false">
    <asp:Panel ID="Panel1" runat="server" Visible="false">
        Content...
    </asp:Panel>
</asp:Panel>

这code是如预期(使外容器中可见,再内胆):

This code is as expected (make outer container visible first, then inner container):

Panel0.Visible = true;
// Now Panel0.Visible returns true and Panel1.Visible returns false
Panel1.Visible = true;
// Now Panel0.Visible returns true and Panel1.Visible returns true

这code是有点令人惊讶(使内胆可见光第一,那么外部容器):

This code is somewhat surprising (make inner container visible first, then outer container):

Panel1.Visible = true;
// Now Panel1.Visible returns false (!, your issue) and Panel0.Visible returns false
Panel0.Visible = true;
// Now Panel1.Visible returns true (!!) and Panel0.Visible returns true

似乎设置和获取Visible属性是非对称:二传手似乎放置标志的控制,但消气返回一个计算值依赖于外部因素的知名度和能见度控制自己。

It seems that setting and getting the Visible property is "asymmetric": The Setter seems to place a flag in the control, but the Getter to return a calculated value which depends on the visibility of the outer elements and the visibility of the control itself.

不知道这是否会帮助你的。

Not sure if this will help you at all.

这篇关于面板可见=真不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆