I'm having trouble creating the dock layout and dock zone, as well as rad docks.
It is not an option to place the docking controls in the aspx or ascx pages.
The following is the code I have. It does not have any errors except for a javascript error that says
'Sys' is undefined.
It is not an option to place the docking controls in the aspx or ascx pages.
The following is the code I have. It does not have any errors except for a javascript error that says
'Sys' is undefined.
| protected void Page_Load(object sender, EventArgs e) |
| { |
| bool smExists = false; |
| foreach (Control control in Page.Form.Controls) |
| if (control is ScriptManager) |
| { |
| smExists = true; |
| break; |
| } |
| if (!smExists) |
| { |
| ScriptManager sm = new ScriptManager(); |
| Page.Form.Controls.Add(sm); |
| Page.Header.Controls.Add(new LiteralControl(@" |
| <script language='javascript'> |
| function changeRadDockHandle(dockID,handleID){ |
| var dock = $find(dockID); |
| dock.set_handle(document.getElementById(handleID)); |
| } |
| </script>")); |
| } |
| RadDockLayout layout = new RadDockLayout(); |
| layout.ID = "layout"; |
| Page.Form.Controls.Add(layout); |
| RadDockZone zone = new RadDockZone(); |
| layout.Controls.Add(zone); |
| RadDockZone zone2 = new RadDockZone(); |
| layout.Controls.Add(zone2); |
| UpdatePanel updatePanel = new UpdatePanel(); |
| updatePanel.ID = "UpdatePanel1"; |
| layout.Controls.Add(updatePanel); |
| zone.FitDocks = true; |
| zone.MinHeight = Unit.Pixel(200); |
| zone.BorderWidth = Unit.Pixel(1); |
| zone.ID = "zone"; |
| zone2.BorderWidth = Unit.Pixel(1); |
| zone2.ID = "zone2"; |
| RadDock dock = new RadDock(); |
| dock.DockMode = DockMode.Default; |
| dock.Pinned = false; |
| dock.ID = "dock"; |
| dock.ContentContainer.Controls.Add(new LiteralControl("blahblah")); |
| dock.DefaultCommands = Telerik.Web.UI.Dock.DefaultCommands.None; |
| dock.DockHandle = DockHandle.None; |
| dock.OnClientInitialize = CreateJavaScriptFunctionCall(dock); |
| zone.Controls.Add(dock); |
| zone.Orientation = Telerik.Web.UI.Orientation.Horizontal; |
| zone2.Orientation = Telerik.Web.UI.Orientation.Vertical; |
| } |
| string CreateJavaScriptFunctionCall(RadDock dock) |
| { |
| string dockHandleID = ""; |
| foreach (Control control in dock.ContentContainer.Controls) |
| { |
| if (control is LiteralControl) |
| { |
| dockHandleID = control.ClientID; |
| } |
| } |
| return "changeRadDockHandle('" + dock.ClientID + "','" + dockHandleID + "')"; |
| } |
What am I doing wrong?
This is a simple web project in VS 2005.