How do I display different AJAX update panels in one location in ASP.NET?
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 o开发者_运维技巧n 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?
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!
Use a tab container
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/Tabs/Tabs.aspx
精彩评论