问题
In my ASP.NET 3.5 project, most content pages have ScriptManager control but the Master Page does not have. I now want to use UpdatePanel in the master page but it is not permitting to put another ScriptManager.
I cannot change to ScriptManagerProxy in content pages as the change needs to be replicated to around fifty pages.
Is there any way to use UpdatePanel in Master Page by either sharing content page's ScriptManager or something else?
回答1:
three ways I can think.
First way is to use place the ScriptManager
inside the ContentPlaceHolder, on the other pages that also have ScriptManager
this will be overwrite, in the one that you want to exist, just not use this ContentPlaceHolder, if this is possible.
<asp:ContentPlaceHolder ID="PlaceHolderID" runat="server" >
<asp:ScriptManager ID="ScrMang" runat="server" >
</asp:ScriptManager>
</asp:ContentPlaceHolder>
Second way is to make a second master page, come from the first, and use this second master page with ScriptManager and all the rest, if this is possible.
And last, change all 50 pages, move the ScriptManager
to master page, remove it from the rest. Some time we do that :)
来源:https://stackoverflow.com/questions/13569855/how-to-use-ajax-in-master-page-when-content-pages-have-scriptmanager