在 asp:Panel 中隐藏 DIV?
我想这是一个简单的问题......
我有一个可以打开和关闭的面板。在此面板中,我有一个带有附加样式的 div。
我的问题是,当我将面板的可见性设置为 false 时,div 的样式仍然存在。对此有什么解决办法呢?
问候
<div id="ctl00_FullContentRegion_xFormRightPanel">
<div class="contactform form-orange" style="float: right; margin-left: 10px; width: 462px;">
</div>
</div>
HTML:
<asp:Panel ID="xFormRightPanel" runat="server">
<div class="contactform form-orange" style="float: right; margin-left: 10px; width: 462px;">
<EPiServer:Property ID="Property3" PropertyName="XformRight" runat="server" />
</div>
</asp:Panel>
This is a simple question i guess....
I have a panel that i can turn on and off. Within this panel i have a div with style attached to it.
My problem is when i turn the visible of the panel to false the style of the div is still there. What the solution to this?
Regards
<div id="ctl00_FullContentRegion_xFormRightPanel">
<div class="contactform form-orange" style="float: right; margin-left: 10px; width: 462px;">
</div>
</div>
HTML:
<asp:Panel ID="xFormRightPanel" runat="server">
<div class="contactform form-orange" style="float: right; margin-left: 10px; width: 462px;">
<EPiServer:Property ID="Property3" PropertyName="XformRight" runat="server" />
</div>
</asp:Panel>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此操作是在回发时发生的吗?如果是这样,请使面板从服务器端不可见
这将确保面板中的所有内容都不会在浏览器上呈现。
根据我上面的理解,你可能已经在这样做了,所以只需回顾一下这些点:
关闭面板?
你期望的元素?
看着另一个元素(某处
HTML 中的其他内容)
误认为这个?
Is this action happening on a postback? If so make the panel invisible from the server side
This will ensure everything within the panel is not rendered at all on the browser.
From what I can understand above you are possibly already doing this so just run over these points:
closed the panel?
elements you expect?
looking at another element (somewhere
else in the HTML) that you've
mistaken for this?
不要更改其可见性,而是更改其 CSS 显示属性,即
因为具有隐藏可见性属性的项目不会显示,但仍然占用页面上的空间,而具有 display:none 属性的项目将完全隐藏,并且不会占用空间。
instead of changing its visibility, change its CSS display property i.e.
since items with the hidden visibility property are not shown, but still take space on the page where as items with display:none property will be hidden completely, and will take no space.