This is a migrated thread and some comments may be shown as answers.
RadDock with MasterPage and User Control
1 Answer 45 Views
This is a migrated thread and some comments may be shown as answers.
Vaseem Anjum
Top achievements
Rank 1
Vaseem Anjum asked on 30 Nov 2011, 11:53 AM
Hi,

I am new to use RadDock and doing a page similar to the one that looks like iGoogle where we can add gadgets to the page dynamically and realign, edit, close added docks with in one main dashboard (I am calling with that name) page. Each gadget chosen from the list will get loaded into the RadDockZone which there after can be realigned, refreshed by changing drop down and clicking on a button. My requirement is when the ascx control loaded into the dock is submitted (postback) the remaining widgets should not be refreshed or reloaded.


The current page architecture is like, 
1. I have a master page within which some banner (header and few links like settings, signout) and footer (some information and few navigation links) will be present.
2. I have an .aspx page (inside master page) where sliding page with few buttons (called as Gadgets that are dynamically loaded like flickr, twitter, horoscope etc.,), RadDockLayout with 3 RadDockZone(s) inside layout is present.
3. I have a .ascx user controls for each gadget that will interact with the web service (hosted some where) and has its own layout that gets generated with the web service data.


Issue:
When I add the gadget to the page (Default.aspx present in Master.Master), the appropriate user control is getting loaded within the assigned RadDockZone by executing the Page_Load (with IsPostBack as true for the first time). 
After getting the RadDockZone loaded with gadget selected, the first time drag drop of control (widgets/.ascx page) will not work as the moved gadget will be automatically placed into the source RadDockZone (from where we moved the dock).
Another issue is, if you change the selected index to something else within the raddock (SelectedIndexChanged for dropdown with AutoPostBack=true), data is loaded again and selected index will mark to 0. This is because for user control Page_Load is happening with IsPostBack as true.


Please help!!!


Thanks,
J

1 Answer, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 02 Dec 2011, 06:01 PM
Hello Vaseem,

Your scenario seems to be quite similar to the one, implemented in the online demo My Portal, so I would recommend it as a reference for achieving the desired functionality. Note, that it also offers dynamical creation of RadDocks, containing different user controls, with option to select the user control and the RadDockZone. Also, saving the state of the dock controls is implemented via a hidden UpdatePanel so that the docking zones aren't updated every time a RadDock is minimized, moved or closed.

The problems that you have described seem to be caused by incorrect saving and loading of the RadDock's state. I will explain the main steps that need to be executed in order to ensure that the layout is preserved:

1. On the Page_Init event, the RadDock controls are recreated from the storage medium that you have chosen for saving the dock controls' layout. Please keep in mind that you should always set the same ID and UniqueName for every RadDock in order to avoid incorrect layout of the controls.

2. On the LoadDockLayout event of the RadDockLayout control, the indices and the RadDockZones for every RadDock is restored from the dock state storage.

3. On the SaveDockLayout event of the RadDockLayout control, its method GetRegisteredDocksState is used to get the current dock state, which is then saved in the selected storage to be utilized when the page is loaded after a postback.

These steps are incorporated in the demo, linked above, so you can examine their behavior in action.

I hope the provided information will help you resolve your issues.

Regards,
Slav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Dock
Asked by
Vaseem Anjum
Top achievements
Rank 1
Answers by
Slav
Telerik team
Share this question
or