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

Dock Position/Index in DockZone

1 Answer 76 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Siva Kumar
Top achievements
Rank 1
Siva Kumar asked on 25 Jan 2010, 09:19 PM
Hi

I'm trying to add Dock's to a DockZone dynamically. No problem with that. Docks get added to DockZone, but I want to insert a doc to a particular position (between 2 docks); which Im having problems with.

This is what Im trying to do:
a. RadDockZone CurrDocZone = (RadDockZone)FindControl(DocZoneToAdd);
CurrDocZone.Controls.Add(dock);

Always adds to the start of the doczone.

b. Tried,
RadDockZone CurrDocZone = (RadDockZone)FindControl(DocZoneToAdd);
CurrDocZone.Docks.Insert(Position, dock);    
or
CurrDocZone.Controls.AddAt(Position, dock);               

But it throws exception that, A control with ID '<some unique Dock ID>' could not be found for the trigger in UpdatePanel 'UpdatePanel2'.

Can you pls. let me know what could be wrong in there... Pls. let me know if you need more info.

Thanks



1 Answer, 1 is accepted

Sort by
0
Accepted
Pero
Telerik team
answered on 26 Jan 2010, 07:36 AM
Hi Siva,

For the time being there is no server side method (or property) that will add the dock at the desired position (index) in the zone. This can be done with client-script rendered from the server. The following source code registers the script.
int dockPosition = Convert.ToInt32(ddlPosition.SelectedValue);
 
//Register a script to move dock to the last place in the RadDockZone
//The zone.dock(dock,index) client-side method is used
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);


For your convenience I have attached the sample project that I tested.

Please do not hesitate to contact us, if you have any further questions.


Regards,
Pero
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Dock
Asked by
Siva Kumar
Top achievements
Rank 1
Answers by
Pero
Telerik team
Share this question
or