As can be seen with my previous posts on problems I am having with the Docking controls, I decided, perhaps the simplest thing would be to step back from the application I'm building and create a test application.
The first thing I did, was following the documentation, I created a simple page with a RadDockLayout, A RadDockZone, and a single button. In the code behind, I took the code strait out of the documentation for creating dynamic docks. I create a dock dynamically and add it to the RadDockZone.
I ran this simple test page and clicking the button adds a new dock, dynamically created, to my DockZone. Yay! That part works great.
Now, taking it a step further, all I added was a RadAjaxManager and using the designer, hooked up the button as a firing control and the RadDockLayout and RadDockZone as the targets.
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="Button1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadDockLayout1" />
<telerik:AjaxUpdatedControl ControlID="RadDockZone1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
Now, when I run the page and click the button, there is no postback and a Dock appears in the DockZone. Yay ... er ... wait, no. Not Yay, because the Dock is broken. It can't be moved, the controls in the titlebar don't work, and I notice there is a Javascript Error on the page. I open up the error to take a peak and see:
Line: 6
Char: 31345
Error: Object expected
Code: 0
URL: http://localhost:3521/TelerikDockTest/Default.aspx.
So....it appears my issues have nothing to do with my application and there is some fundamental problem with using the AjaxManager to "Ajaxify" and event which dynamically creates a Dock.
Now, what's interesting is if I click the button a couple of times, creating some docks, the error doesn't stop Docks from being created, they just come in "broken." If I then however click the refresh button on my browser, the docks I created are there, there is no error on the page, and I can move the docks and the controls in the titlebar work.
So it seems that in order for a Dock to work correctly it has to be registered during a full page cycle (The Page_Init has to be called) and as far as I can tell there is no intuitive way to Ajaxify the dynamic creation of RadDocks.
I do hope I am wrong, and if so, please guide me to what I need to change in order for this to work as expected.
The first thing I did, was following the documentation, I created a simple page with a RadDockLayout, A RadDockZone, and a single button. In the code behind, I took the code strait out of the documentation for creating dynamic docks. I create a dock dynamically and add it to the RadDockZone.
I ran this simple test page and clicking the button adds a new dock, dynamically created, to my DockZone. Yay! That part works great.
Now, taking it a step further, all I added was a RadAjaxManager and using the designer, hooked up the button as a firing control and the RadDockLayout and RadDockZone as the targets.
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="Button1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadDockLayout1" />
<telerik:AjaxUpdatedControl ControlID="RadDockZone1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
Now, when I run the page and click the button, there is no postback and a Dock appears in the DockZone. Yay ... er ... wait, no. Not Yay, because the Dock is broken. It can't be moved, the controls in the titlebar don't work, and I notice there is a Javascript Error on the page. I open up the error to take a peak and see:
Line: 6
Char: 31345
Error: Object expected
Code: 0
URL: http://localhost:3521/TelerikDockTest/Default.aspx.
So....it appears my issues have nothing to do with my application and there is some fundamental problem with using the AjaxManager to "Ajaxify" and event which dynamically creates a Dock.
Now, what's interesting is if I click the button a couple of times, creating some docks, the error doesn't stop Docks from being created, they just come in "broken." If I then however click the refresh button on my browser, the docks I created are there, there is no error on the page, and I can move the docks and the controls in the titlebar work.
So it seems that in order for a Dock to work correctly it has to be registered during a full page cycle (The Page_Init has to be called) and as far as I can tell there is no intuitive way to Ajaxify the dynamic creation of RadDocks.
I do hope I am wrong, and if so, please guide me to what I need to change in order for this to work as expected.