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

Moving Docks Server Side

1 Answer 75 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Ryan asked on 23 Jan 2009, 12:47 PM
I believe my problem is simple and I have searched for an answer and cannot find one. I have 3 RadDockZones in a RadDockLayout. Each RadDockZone contains 1 RadDock. RadDock1 can be docked in all RadDockZones, RadDock2 cannot be moved and RadDock3 cannot be moved.

What I what to do: When RadDock1 gets docked in RadDockZone2, I want to change the title of RadDock2 to the title of RadDock1 and then move RadDock1 back to its RadDockZone1. And the same for when RadDock1 gets docked in RadDockZone3.

I need this done server side. I got all to work except moving RadDock1 back to its original place. I can manipulate all the docks when I'm in RadDock1_DockPositionChanged. The problem is when I leave RadDock1_DockPositionChanged it sets the DockZoneID back to where RadDock1 was moved to when the routine has ended.

I am using MasterPages.



Sub RadDock1_DockPositionChanged(ByVal sender As Object, ByVal e As Telerik.Web.UI.DockPositionChangedEventArgs) Handles RadDock1.DockPositionChanged, RadDock2.DockPositionChanged, RadDock3.DockPositionChanged



Dim mpContentPlaceHolder As ContentPlaceHolder = CType(Master.FindControl("ContentPlaceHolder3"), ContentPlaceHolder)



Dim i As Int32



Dim iDockTo, iDockFrom As Int32



Dim MyDock As Telerik.Web.UI.RadDock



Dim MyDockZone As Telerik.Web.UI.RadDockZone


iDockFrom = CalcDockNumber(sender.DockZoneID)

iDockTo = CalcDockNumber(e.DockZoneID)


If iDockFrom = iDockTo Then Exit Sub




MyDock = CType(mpContentPlaceHolder.FindControl("RadDock" & iDockTo), Telerik.Web.UI.RadDock)


MyDock.Title = sender.title




MyDock =

CType(mpContentPlaceHolder.FindControl("RadDock" & iDockFrom), Telerik.Web.UI.RadDock)


MyDockZone =

CType(mpContentPlaceHolder.FindControl("RadDockZone" & iDockFrom), Telerik.Web.UI.RadDockZone)








End Sub


1 Answer, 1 is accepted

Sort by
Nikolay Raykov
Telerik team
answered on 26 Jan 2009, 01:20 PM
Hi Ryan,

You should move the dock by using the client-side API of RadDock. In order to do that you need to register a JavaScript function to the page which will move the dock to the first RadDockZone. Here is the code that accomplishes that:

Dim script As String = String.Format("function changeZone(){{" & vbCr & vbLf & "                Sys.Application.remove_load(changeZone);" & vbCr & vbLf & "                $find('{0}').dock($find('{1}'));}};" & vbCr & vbLf & "                Sys.Application.add_load(changeZone);", RadDockZone1.ClientID, sender.ClientID) 
            Page.ClientScript.RegisterStartupScript(Me.GetType(), "dock", script, True

For your convenience I have attached my test page where you could see this in action. You could modify it to meet the needs of your specific scenario.

Nikolay Raykov
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Asked by
Top achievements
Rank 1
Answers by
Nikolay Raykov
Telerik team
Share this question