ASP.NET 更新面板丢失在 ImageButton Click 事件上动态添加的控件

发布于 2024-10-13 05:49:32 字数 462 浏览 7 评论 0原文

问候程序,

我正在开发查询另一个网站的应用程序,并拉回 xml,然后我用 ImageButton 填充结果面板,并在单击事件中填充时间,当单击图像时,我想使用弹出一个 div 框jquery ui,将显示有关单击的图片的更多信息。然而,每当 id 这似乎消除了我的结果面板(面板控制),并且 div 框永远不会出现,据我所知,图像按钮单击事件永远不会触发。我尝试过两种方法,一种是使用更新面板,另一种是不使用,我将不胜感激。我想知道我是否在单击搜索按钮时做得太长,我想知道我是否应该让帖子发布打包填充结果面板的句柄并放弃更新面板。

(是的,我的 div 标签设置为 runat server)

我也在寻求建议,也许有更好的方法来做到这一点,我认为为每个项目创建隐藏的 div 标签,然后在单击图像时运行 javascript以这种方式显示它,但是这看起来很愚蠢,在我看来,让我的 div 控件一次然后在每个图像单击时更新其中的标签然后显示或隐藏它似乎更有意义。

greeting programs,

Im working on app that queries another website, and pulls back an xml, I then populate a result panel with ImageButton(s), and time in a click event, when the image is click I want to popup a div box using the jquery ui, that will show more information, about the picture clicked on. however whenever id this this seems to wipe out my results panel(Panel Control) and the div box never appears and as far as I can tell the imagebutton click event never fires. I've tried doing this two ways one with an update panel and again without, I would appreciate any help on this.Im wondering if I'm doing to much long on my search button click, Im wonder if I should just let the post pack handle populating the result panel and ditch the update panel.

(and yes my div tag is set to runat server)

I'm also up for suggestions maybe there is a better way to do this, I thought creating hidden div tags for each item, and then running javascript for when the image is clicked and showing it that way, However that seems stupid, in my opinion it seems to make more sense to make my div control once and then update the labels inside it on each image click and then show or hide it.

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

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

发布评论

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

评论(1

甚是思念 2024-10-20 05:49:32

如果我不得不猜测,无需查看您的代码,我会说发生了回发并清除了您的所有数据,因为这与任何视图状态可能认为的事情应该具有的不匹配。如果您已经在页面上使用 jQuery 和 jQuery UI,我建议您也使用 jquery 执行“更多信息弹出窗口”。

如果您已经在页面上有了信息,并且只是想向用户显示它,为什么还要使用图像按钮的 onclick 函数呢?

Without looking at your code if I had to guess I would say that a post back occurs and wipes out all of your data since that doesn't match whatever viewstate may think things should have. If you're using jQuery and jQuery UI on the page already I would suggest you also do your "more information popup" with jquery.

If you already have the information on the page and you're just trying to show it to the user why bother using an imagebutton's onclick function.

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