How to set raddock at a specific position inside the raddockzone

2 posts, 0 answers
  1. Gaurav
    Gaurav avatar
    4 posts
    Member since:
    Sep 2011

    Posted 21 Sep 2011 Link to this post

    Hello,

    I create raddock dynamically. I wish to add newly created raddock at  any position in the raddockzone.

    RadDockZone1.Controls.Add(dock) - adds dock at index 0 by default.

    Can you please suggest approach to add newly created raddock at any position in the raddockzone ?

    Thanks
  2. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 23 Sep 2011 Link to this post

    Hello Gaurav,

    Adding the RadDock dynamically to a selected position in the RadDockZone can be achieved by a client script, which is registered from the server and moves the dock to the desired position. Below you can find a code snippet, demonstrating how to register the suggested JavaScript function. Overall, it gets from a DropDownList the RadDockZone in which the RadDock should be docked and calls the client method dock.
        ScriptManager.RegisterStartupScript(this,
            this.GetType(),
            "MoveDock",
        string.Format(@"function _moveDock() {{
                                Sys.Application.remove_load(_moveDock);
                                $find('{1}').dock($find('{0}'),{2});
                                }};
                                Sys.Application.add_load(_moveDock);", dock.ClientID, DropDownZone.SelectedValue, dockPosition),
        true);
    }

    The script, presented above, should be registered in the server-side event handler, used for dynamically creating a RadDock.

    For your convenience I have attached a sample project, implementing the suggested solution. Please use it as a reference for incorporating the desired functionality. 

    Greetings,
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top