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

How to set raddock at a specific position inside the raddockzone

1 Answer 85 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Gaurav
Top achievements
Rank 1
Gaurav asked on 21 Sep 2011, 06:25 AM
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

1 Answer, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 23 Sep 2011, 09:01 AM
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
Tags
Dock
Asked by
Gaurav
Top achievements
Rank 1
Answers by
Slav
Telerik team
Share this question
or