I have a need to either have multiple script managers on a page or the ability to hide/remove one after the page is generated. The reason for this is because of some iframe workarounds for the iPad. My code is posted below, sorry for the long code block. Thanks for any help you can offer.
Main Page:
<html>
<body>
<telerik:RadScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Path="javascript/jquery.js" />
<asp:ScriptReference Path="javascript/enforceMaxlength.js" />
</Scripts>
</telerik:RadScriptManager>
<telerik:RadSplitter ID="rsMain" runat="server" Orientation="Vertical" Width="100%" BorderSize="0" PanesBorderSize="0" ResizeWithBrowserWindow="true">
<telerik:RadPane id="rpContent" runat="server">
<cc1:ScrollingIFrame id="sifMainContent" runat="server" Width="100%" Height="100%" />
</telerik:RadPane>
</telerik:RadSplitter>
</body>
</html>
ScrollingIFrame User Control:
<div id="theDiv" runat="server" style="position:relative; overflow:auto"></div>
<script type="text/javascript" charset="utf-8">
$('#<%= theDiv.ClientID %>').load('TestPage.aspx', function () {});
</script>
TestPage.aspx:
<html>
<body>
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager ID="ScriptManager1" runat="server" />
[A Bunch of Dynamically Generated Controls That Require a ScriptManager...]
</div>
</form>
</body>
</html>
Just to clarify, the final output page ends up being a resolved version of this:
(Notice the two script managers on the same page)
<html>
<body>
<form id="mainForm" runat="server">
<telerik:RadScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Path="javascript/jquery.js" />
<asp:ScriptReference Path="javascript/enforceMaxlength.js" />
</Scripts>
</telerik:RadScriptManager>
<telerik:RadSplitter ID="rsMain" runat="server" Orientation="Vertical" Width="100%" BorderSize="0" PanesBorderSize="0" ResizeWithBrowserWindow="true">
<telerik:RadPane id="rpContent" runat="server">
<div id="theDiv" runat="server" style="position:relative; overflow:auto">
<form id="form1" runat="server">
<div>
<telerik:RadScriptManager ID="ScriptManager1" runat="server" />
[A Bunch of Dynamically Generated Controls That Require a ScriptManager...]
</div>
</form>
</div>
</telerik:RadPane>
</telerik:RadSplitter>
</form>
</body>
</html>
You must have only one script manager instance on a page. In your case, you are trying to combine two pages into one, which means that the two script managers will override each other’s scripts. You need to remove the RadScriptManager control from the inner page and leave only the one in the main page. To prevent server errors with the RadControls in the inner page, you should set RegisterWithScriptManager=false for each control in the TestPage.aspx inner page. With this property, the controls will render everything they need and rely that you have a ScriptManager somewhere else (in this case on the main page).