中继器中的 UpdatePanel 覆盖其下方的控件

发布于 2024-07-17 00:34:51 字数 642 浏览 6 评论 0 原文

我有一个中继器,里面有一个 ASP.NET AJAX 1.0 UpdatePanel。 UpdatePanel 外部有一些按钮,但仍在中继器中。 当 UpdatePanel 内的一个部分出现时(它是一个隐藏的面板控件,当用户以某种方式回答问题时出现),底部的按钮就会消失。

这是一个例子。

[REPEATER]
  [UPDATEPANEL]
     [QUESTION]   <-- when user says yes, Panel appears
     [PANEL]
  [/UPDATEPANEL]
  [TABLE]         <-- This table is no longer visible.
     [Button]
  [/TABLE]
[/REPEATER]

如果我将表格移至页面顶部,内容不会消失,因此我怀疑这是样式问题,控件实际上在那里,但位于 UpdatePanel 内容的下方。 我尝试添加 就在桌子前,无济于事。

知道我该如何解决这个问题吗?

编辑:我有一个错误的缺少结束标记,导致 UpdatePanel 超出应有的范围,因此它隐藏了我的控件。 使用 Firefox 插件有助于识别这一点。

I have a Repeater with an ASP.NET AJAX 1.0 UpdatePanel inside it. There are buttons outside of the UpdatePanel but still in the repeater. When a section inside the UpdatePanel appears (it's a hidden Panel control that appears when user answers a question a certain way), the buttons at the bottom disappear.

Here is an illustration.

[REPEATER]
  [UPDATEPANEL]
     [QUESTION]   <-- when user says yes, Panel appears
     [PANEL]
  [/UPDATEPANEL]
  [TABLE]         <-- This table is no longer visible.
     [Button]
  [/TABLE]
[/REPEATER]

If I move the table to the top of the page, the content does not disappear, so I suspect it is a style issue, where the controls are actually there, but are underneath the content of the UpdatePanel. I've tried adding a <br clear="all"/> to just before the table, to no avail.

Any idea how I might fix this?

Edit: I had an errant missing closing tag that caused the UpdatePanel to extend further than it should've, so it was hiding my control. Using the Firefox plugins helped identify this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

指尖上的星空 2024-07-24 00:34:51

我的建议是在更新发生后使用 Firefox 和 Web Developer 工具栏查看生成的源代码或使用 Firebug 检查元素。 如果表格 html 仍在页面上,则可能是样式问题或面板中 HTML 格式错误的问题,导致表格无法正确呈现。 如果表 html 丢失,那么它会被 AJAX 回调从 DOM 中删除(或覆盖)。 您或许还可以使用 Firebug 来调试实际的 AJAX 回调,以查看实际替换的内容和时间。

如果您仍然无法弄清楚并需要更多输入,那么在问题更新之前和之后发布生成的 HTML 也会很有帮助。

My suggestion is to use Firefox and the Web Developer toolbar to do a View Generated Source after the update has occurred or inspect the elements with Firebug. If the table html is still on the page, then it could be either a style issue or an issue with malformed HTML in the panel causing the table not to render properly. If the table html is missing, then it is being removed from the DOM (or overwritten) by the AJAX callback. You might be able to use Firebug to debug the actual AJAX callback as well to see what and when things are actually being replaced.

Posting the generated HTML before and after the update in your question would also be helpful if you still can't figure things out and want more input.

青巷忧颜 2024-07-24 00:34:51

将表格放入更新面板中,或将整个中继器放入一个更新面板中。

Put the table inside the updatepanel, or put the whole repeater in one updatepanel.

沫离伤花 2024-07-24 00:34:51

请注意,Clear 属性自 HTML 4.01 起已弃用 不包含在XHTML Strict - 您使用的是什么文档类型 - 如果您使用严格(并且您显然正在使用某种 XHTML,因为您已经关闭了 br),那么您的浏览器完全有权忽略明确的属性。

您最好使用 CSS 执行此操作:

<style type="text/css">
  .cleaner{
    clear: both;
  }
</style>

<br class="cleaner" />

此外,您可以尝试将 br 放在面板后面,以便它返回到 UpdatePanel 中并强制浏览器接受它。

Note that the Clear attribute is Deprecated as of HTML 4.01, and isn't included in XHTML Strict - what document type are you using - if you're using strict (and you're clearly using XHTML of some kind, because you've closed your br), then your browser has every right to ignore the clear attribute.

You would be better off doing this with CSS:

<style type="text/css">
  .cleaner{
    clear: both;
  }
</style>

<br class="cleaner" />

Also, you could try putting the br after the panel, so that it comes back in the UpdatePanel and forces the browser to honour it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文