简体   繁体   中英

Using user controls with Ajax within asp.net application

I have an asp.net application in which i have nested master pages. The problem is that i have many difficulties to use an update panel to refresh only a part of the page in a child master page or a web form which inherits from a master page different of the parent one. I think this problem is caused by my use of update panel in the parent master page . So , because I worked with the user controls in WPF application and i'm using to put a container which its contents( which is a user control) changes dynamically when i need to, i wonder if i have two user controls ( login and inscription for example ) and i have this code in my view :

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                           //putting a user control
                        </ContentTemplate>
                    </asp:UpdatePanel>
  • How can i change dynamically the user control used in the update panel?
  • Is it a good approach to do like this?

Thanks,

  1. The documentation on MSDN states:

To add items to the UpdatePanel control dynamically, use the ContentTemplateContainer property, which enables you to add child controls without having to create a custom template that implements the ITemplate interface.

  1. I found that anytime I try to use the UpdatePanel, it ends up causing tons of problems. I've found using AJAX (with jQuery to make it easier) to be a much better solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM