Dock - DockPositionChanged event fires after Init

3 posts, 0 answers
  1. AnneArents
    AnneArents avatar
    14 posts
    Member since:
    Jan 2010

    Posted 06 Nov 2012 Link to this post


    I'm using dynamically created RadDockZones and RadDocks to represent data.
    Everything is dynamically created during the Page_Init event.
    Whenever a Dock is dragged to a different DockZone, I want to save its new position (DockZone) in the database.
    I'm using the DockPositionChanged event for this.

    However, when a Dock is dragged to another DockZone, triggering the DockPositionChanged event, the Page_Init event is fired BEFORE the DockPositionChanged event.
    This means that while the new position (DockZone) of the Dock is correctly saved in the database, it's not shown until a refresh of the page.

    Is there a way to deal with this without having to go throught the trouble of loading/saving the state?

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 06 Nov 2012 Link to this post


    Try the following code to achieve your scenario.

    protected void RadDockZone1_Init(object sender, EventArgs e)
     if (!IsPostBack)
       // Your Code

    Hope this helps.

  3. Slav
    Slav avatar
    1359 posts

    Posted 09 Nov 2012 Link to this post


    The recommended approach for dynamically creating RadDocks and persisting their state is described in this help article. If you implement it, the RadDockLayout will take care of displaying the docks in the correct position when they are moved and a postback occurs.

    If you still want to use your custom approach for saving/loading the state, I would suggest utilizing the DockPositionChanged event in order to get the dock zone, in which the dock is currently placed, and dock it in this zone through the Dock method as shown below:
    public void RadDock1_DockPositionChanged(object sender, DockPositionChangedEventArgs e)
        string currentDockZone = e.DockZoneID;

    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.
Back to Top