如何在 ASP.NET 的一个位置显示不同的 AJAX 更新面板?

发布于 2024-08-29 12:29:45 字数 165 浏览 2 评论 0原文

我有一个顶部有 5 个按钮的页面。我希望按钮下方的区域包含一个更新面板,如果他们单击按钮 1,该面板将显示按钮 1 的面板。如果他们单击按钮 2,那么我希望按钮 2 的更新面板替换按钮 1 的更新面板。每个面板上都有诸如复选框和文本框之类的东西。

有办法做到这一点吗?有没有更有效的方法来做到这一点?

I have a page with 5 buttons on top. I want the area below the buttons to contain an update panel that will display button 1's panel if they click button 1. If they click on Button 2, then I want button 2's update panel to replace the button 1 update panel. Each panel has stuff on it like check boxes and text boxes.

Is there a way to do this? Is there a more efficient way to do this?

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

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

发布评论

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

评论(2

终遇你 2024-09-05 12:29:46

很简单,我的朋友.. 只需要一个包含多个 asp:Panel 或 asp:PlaceHolders 的更新面板即可。所有这些都应该是可见的,除了应该根据单击的按钮显示的之外。

如果您的按钮位于 UpdatePanel 内 - 您就完成了。
如果他们在外面 - 没问题!将 AsyncPostBackHandler 添加到指向这些按钮的 UpdatePanel。即使按钮不在 UpdatePanel 中,仍然会生成 AJAX 回调:)

如果您也需要,可以引入示例!

Easy, my friend.. Just have a single update panel with multiple asp:Panel or asp:PlaceHolders inside. All of these should be visible, except the one that should be displayed based on the clicked button.

If your buttons are inside the UpdatePanel - you're done.
If they're outside - no problems! Add AsyncPostBackHandlers to the UpdatePanel pointing to these buttons. Even though the buttons are not in an UpdatePanel then will still generate an AJAX callback :)

Can bring in an example if you need it too!

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