How to use AJAX in master page when content pages have ScriptManager?

倖福魔咒の 提交于 2019-12-12 04:42:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!