如何在 ASP.NET 的一个位置显示不同的 AJAX 更新面板?
我有一个顶部有 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
很简单,我的朋友.. 只需要一个包含多个 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!
使用选项卡容器
http://www.asp.net/ajax/ ajaxcontroltoolkit/Samples/Tabs/Tabs.aspx
Use a tab container
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/Tabs/Tabs.aspx