RadDock with MasterPage and User Control

2 posts, 0 answers
  1. Vaseem Anjum
    Vaseem Anjum avatar
    12 posts
    Member since:
    Mar 2007

    Posted 30 Nov 2011 Link to this post


    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.

    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!!!

  2. Slav
    Slav avatar
    1351 posts

    Posted 02 Dec 2011 Link to this post

    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.

    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
  3. DevCraft R3 2016 release webinar banner
Back to Top