This is a migrated thread and some comments may be shown as answers.

RadDockLayout Failes to Fire OnLoadDockLayout Event when embedded within a dynamically added usercontrol.

2 Answers 61 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Mario Lozano
Top achievements
Rank 1
Mario Lozano asked on 20 Sep 2008, 11:35 PM
So here's the setup... I have working code for a RadDockLayout with dynamically added controls from database records using 2008.0.826.20. This scenario has the RadDockLayout setup in a UserControl which needs to be dynamically added to a PlaceHolder control already on the page. When I setup and test the Docking solution with the UserControl placed on the page everything works as expected and the OnLoadDockLayout and OnSaveDockLayout events fire as expected. However, simply adding a PlaceHolder to the page and loading the UserControl dynamically during Page_Load the OnLoadDockLayout event never fires and state is not persisted.

The following is the code used to load the UserControl during Page_Load

Control _ctrl = LoadControl("App_Templates/TemplateGeneralContentNEW.ascx");
_ctrl.ID = "Test";
phMod.Controls.Add(_ctrl);

Any assitance or insight into why this is happening and how to correct it is greatly appreciated.

Jason

2 Answers, 1 is accepted

Sort by
0
Mario Lozano
Top achievements
Rank 1
answered on 20 Sep 2008, 11:48 PM
Upon further reviewing and testing of this scenario I did find that changing the dynamic attachment of the UserControl from the Page_Load event to Page_Init resolved this problem in both PlaceHolder and RadPageView which are both in use in my scenario.

I am still interested to know more about this behaviour in the page lifecycle as the UserControl was using Page_Init handle the initial setup from the database and loading from state. The initial loading of the docks worked well.

Thanks,

Jason
0
Sophy
Telerik team
answered on 23 Sep 2008, 03:03 PM
Hi Jason,

If you are dynamically creating the RadDockLayout it should be created at Page_Init as the RadDockLayout maintains the state and the proper positioning of the RadDocks inside it. I suggest you also take a look at the RadDock LifeCycle help article for reference. You can also review the following online examples:
Let us know if you need further assistance.

Kind regards,
Sophy
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Dock
Asked by
Mario Lozano
Top achievements
Rank 1
Answers by
Mario Lozano
Top achievements
Rank 1
Sophy
Telerik team
Share this question
or