I am trying to use code similar to the raddock samples , fcreating dynamically raddocks and inserting them in raddockzones.
I use the same code for creating the docks
protected void AddNewDock(ModuleItem m,RadDockZone zn )
{
Trace2.WriteLineIf(PageTraceSwitch.Sw.TraceVerbose, string.Format("[V]PageLayout AddNewDock module ID: {0}, zone.ID: {1}, zone.ClientID: {1}", m.ID,zn.ID,zn.ClientID));
RadDock dock = CreateRadDock(m);
UpdatePanel1.ContentTemplateContainer.Controls.Add(dock);
string scrpt = string.Format(@"function _addDock() {{ Sys.Application.remove_load(_addDock);
$find('{1}').dock($find('{0}'));
$find('{0}').doPostBack('DockPositionChanged');}};
Sys.Application.add_load(_addDock);",dock.ClientID,zn.ClientID);
Trace2.WriteLineIf(PageTraceSwitch.Sw.TraceVerbose, string.Format("[V]PageLayout AddNewDock script:\r\n {0}", scrpt));
ScriptManager.RegisterStartupScript(dock,GetType(),"AddDock",scrpt,true);
CreateSaveStateTrigger(dock);
dock.Tag = m.ID.ToString();
}
My aspx page is very similar but the raddocklayout in in the pageview of a Mutipage with a RadTabStrip.
<radTS:PageView ID="Pageview2" Width=100% runat="server">
<fieldset id="Fieldset2" class="SettingsTableGroup" runat="server">
<legend id="legend1" runat="server">
<asp:Literal ID="Literal1" Text="<%$ Resources:ResourcesWTCRM,PAGESETTINGS_LAYOUT %>"
runat="server"></asp:Literal>
</legend>
<table cellspacing="1" cellpadding="2" border="0" width=100%>
<tr>
<td>
<asp:Literal ID="addmodule" runat="server" Text="<%$ Resources:ResourcesWTCRM,AM_ADDMODULE %>"></asp:Literal></td>
<td>
<asp:Literal ID="module_type" runat="server" Text="<%$ Resources:ResourcesWTCRM,AM_MODULETYPE %>"></asp:Literal></td>
<td colspan="2">
<asp:DropDownList ID="moduleType" runat="server" CssClass="NormalTextBox" DataTextField="FriendlyName"
DataValueField="ModuleDefID">
</asp:DropDownList></td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Literal ID="moduleLocationLabel" runat="server" Text="<%$ Resources:ResourcesWTCRM,AM_MODULELOCATION %>"></asp:Literal></td>
<td valign="top" colspan="2">
<asp:DropDownList ID="paneLocation" runat="server">
<asp:ListItem Value="LeftPane" Text="<%$ Resources:ResourcesWTCRM,AM_MODULELOCATION_LEFT %>"></asp:ListItem>
<asp:ListItem Value="ContentPane" Selected="True" Text="<%$ Resources:ResourcesWTCRM,AM_MODULELOCATION_CENTER %>"></asp:ListItem>
<asp:ListItem Value="RightPane" Text="<%$ Resources:ResourcesWTCRM,AM_MODULELOCATION_RIGHT %>"></asp:ListItem>
</asp:DropDownList></td>
</tr>
<tr>
<td>
</td>
<td valign="top" class="Normal">
<asp:Literal ID="moduleVisibleLabel" runat="server" Text="<%$ Resources:ResourcesWTCRM,AM_MODULEVISIBLETO %>"></asp:Literal></td>
<td valign="top" colspan="2">
<asp:DropDownList ID="viewPermissions" runat="server">
<asp:ListItem Value='<% Config.CRMAllUsers+";"%>' Selected="True" Text="<%$ Resources:ResourcesWTCRM,AM_MODULEVISIBLETO_ALLUSERS %>"></asp:ListItem>
<asp:ListItem Value="Authenticated Users;" Text="<%$ Resources:ResourcesWTCRM,AM_MODULEVISIBLETO_AUTHENTICATED_USERS %>"></asp:ListItem>
<asp:ListItem Value="System Administrator;" Text="<%$ Resources:ResourcesWTCRM,AM_MODULEVISIBLETO_ADMINSROLE %>"></asp:ListItem>
</asp:DropDownList></td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Literal ID="module_name" runat="server" Text="<%$ Resources:ResourcesWTCRM,AM_MODULENAME %>"></asp:Literal></td>
<td colspan="2">
<asp:TextBox ID="moduleTitle" runat="server" Text="<%$ Resources:ResourcesWTCRM,AM_NEWMODULENAME %>" CssClass="NormalTextBox"
Width="250" EnableViewState="false"></asp:TextBox>
<asp:ImageButton ID="AddModuleBtn" SkinID="AddModule" runat="server" AlternateText="<%$ Resources:ResourcesWTCRM,AM_ADDMODULEBELOW %>" />
</td>
</tr>
<tr>
<td colspan="4">
<hr noshade=noshade size="1" />
</td>
</tr>
<tr valign="top">
<td colspan=3 >
<telerik:raddocklayout runat="server" id="RadDockLayout1">
<div style="width:660px;margin-left:auto;margin-right:auto" >
<telerik:raddockzone runat="server" id="RadDockZone1" width="30%" MinHeight="200" style="float:left;margin-right:5%;background: #f5f4e8;" /> </telerik:raddockzone>
<telerik:raddockzone runat="server" id="RadDockZone2" width="30%" MinHeight="200" style="float:left;margin-right:5%;background: #d5f0fa;" />
<telerik:raddockzone runat="server" id="RadDockZone3" width="30%" MinHeight="200" style="float:left;background: #d5f0fa;" />
</div>
<div style="display:none">
<asp:updatepanel runat="server" id="UpdatePanel1" >
<triggers>
<asp:asyncpostbacktrigger controlid="AddModuleBtn" eventname="Click" />
</triggers>
</asp:updatepanel>
</div>
</telerik:raddocklayout>
</td>
</tr>
<tr>
<td class="Error" align="center" colspan="4">
<asp:Literal ID="msgError" runat="server" Text="<%$ Resources:ResourcesWTCRM,AM_NO_RIGHTS %>"></asp:Literal>
</td>
</tr>
</table>
</fieldset>
</radTS:PageView>
This page is using a masterpage which contains a radscriptmanager
<telerik:RadScriptManager ID="WTScriptManager" Runat="server" EnableScriptGlobalization="true" EnableScriptLocalization="true" EnableTheming="True">
</telerik:RadScriptManager>
the page itself hase a proxy as:
<asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat=server />
[V]Global Application_Error ex : System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. --->
System.InvalidOperationException: Script controls may not be registered after PreRender.
at System.Web.UI.ScriptControlManager.RegisterScriptControl[TScriptControl](TScriptControl scriptControl)
at System.Web.UI.ScriptManager.RegisterScriptControl[TScriptControl](TScriptControl scriptControl)
at Telerik.Web.UI.RadWebControl.RegisterScriptControl()
at Telerik.Web.UI.RadWebControl.OnPreRender(EventArgs e)
at Telerik.Web.UI.RadInputControl.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Where is the error ?
I can't understand why I get this full pstback and not an ajax call ?
Thanks for help.
CS