Greetings!
I'm developing a little Web application and use the RadDock as my base classes. I override OnPreRender and Render for RadDockZone.
What I'm trying to do is dynamically add the RadDockLayout based on a column structure; I mean, I have a button to add a RadDockLayout to my default ASP.NET page, and I pass a column count, with this I create my RadDockZones. If I pass 2 columns, the RadDockLayout will have 2 RadDockZones. Everything is fine here, the problem comes when I want to add a RadDock to any of my RadDockZones. I use this as guide to my code.
When I'm debugging and reach for the overriden OnPreRender in the RadDockZone derived class, in the line of base.OnPreRender( e ), it throws a System.InvalidOperationException: Script controls may not be registered after PreRender.
Here is some code in the RadDockZone derived class:
protected
override void OnPreRender( EventArgs e )
{
if ( !DesignMode )
{
ScriptManager scriptManager = ScriptManager.GetCurrent( base.Page );
if ( scriptManager == null )
throw new HttpException();
scriptManager.RegisterScriptControl( this );
}
base.OnPreRender( e ); // The exception occurs here, after I add a RadDock.
}
Code in the Default.aspx.cs:
protected
void btnAddRdDockDerived_Click( object sender, EventArgs e )
{
var rdLayoutDerived = PageState;
var rdDockDerived= CreateRdDockDerived( txtRddDerivedName.Text );
rdLayoutDerived.Zones[0].DocksDerived.Add( widget );
rdDockDerived.Dock( rdLayoutDerived.Zones[0] );
CreateSaveStateTrigger( widget );
PageState = rdLayoutDerived ;
}
protected
override void OnPreRender( EventArgs e )
{
base.OnPreRender( e );
var rdLayoutDerived = PageState;
if ( rdLayoutDerived != null )
{
updater.ContentTemplateContainer.Controls.Add( rdLayoutDerived );
PageState = rdLayoutDerived ;
}
}
PageState is a property that saves the RadDockLayout and its children in the session.
I thank to any help that anyone can give me.

<system.web.extensions>
<scripting>
<scriptResourceHandler enableCompression="true" enableCaching="true"/>
</scripting>
</system.web.extensions>
<compilation debug="false">