Hi there,
I have added a RadDock to RadDockZone1 dynamically from code behind, then drag the RadDock to RadDockZone2, the docks count in RadDockZone2 still shows 0 (
RadDockZone2.Docks.Count). However, if I drag a static dock from RadDockZone1 to RadDockZone2, the dock count number in RadDockZone2 is correct. Please see the following code for details (RadDockTest.aspx and RadDockTest.aspx.cs). Any help is much appreciated. Thank you.
I have added a RadDock to RadDockZone1 dynamically from code behind, then drag the RadDock to RadDockZone2, the docks count in RadDockZone2 still shows 0 (
RadDockZone2.Docks.Count). However, if I drag a static dock from RadDockZone1 to RadDockZone2, the dock count number in RadDockZone2 is correct. Please see the following code for details (RadDockTest.aspx and RadDockTest.aspx.cs). Any help is much appreciated. Thank you.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadDockTest.aspx.cs" Inherits="RadDockTest" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<
html
xmlns
=
'http://www.w3.org/1999/xhtml'
>
<
head
id
=
"Head1"
runat
=
"server"
>
<
title
>ASP.NET Dock Demo - AutoPostBack</
title
>
<!--[if lte IE 6]>
<
style
type
=
"text/css"
>
.raddockzone{height:250px}
</
style
>
<![endif]-->
<
style
type
=
"text/css"
>
.qsfConsole {
margin-top: 19px;
}
</
style
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
runat
=
"server"
ID
=
"RadScriptManager1"
/>
<
telerik:RadSkinManager
ID
=
"QsfSkinManager"
runat
=
"server"
ShowChooser
=
"true"
/>
<
telerik:RadFormDecorator
ID
=
"QsfFromDecorator"
runat
=
"server"
DecoratedControls
=
"All"
EnableRoundedCorners
=
"false"
/>
<
telerik:RadDockLayout
runat
=
"server"
ID
=
"RadDockLayout1"
>
<
table
>
<
tr
>
<
td
style
=
"vertical-align: top"
>
Docking Zone 1<
br
/>
<
br
/>
<
telerik:RadDockZone
runat
=
"server"
ID
=
"RadDockZone1"
Width
=
"270px"
MinHeight
=
"360px"
>
<
telerik:RadDock
runat
=
"server"
ID
=
"RadDock1"
Title
=
"AutoPostBack enabled"
EnableRoundedCorners
=
"true"
>
<
ContentTemplate
>
This RadDock control will initiate postback when it is moved around the page. You
could create AsyncPostbackTrigger to replace the postback with an AJAX call.
</
ContentTemplate
>
</
telerik:RadDock
>
<
telerik:RadDock
runat
=
"server"
ID
=
"RadDock2"
Title
=
"AutoPostBack disabled"
EnableRoundedCorners
=
"true"
>
<
ContentTemplate
>
This RadDock control will NOT initiate postback when it is moved around the page.
However, if you post back the page using another control, the DockPositionChanged
event will be fired.
</
ContentTemplate
>
</
telerik:RadDock
>
</
telerik:RadDockZone
>
</
td
>
<
td
style
=
"vertical-align: top"
>
Docking Zone 2<
br
/>
<
br
/>
<
telerik:RadDockZone
runat
=
"server"
ID
=
"RadDockZone2"
Width
=
"270px"
MinHeight
=
"360px"
>
</
telerik:RadDockZone
>
</
td
>
</
tr
>
</
table
>
</
telerik:RadDockLayout
>
<
asp:Button
ID
=
"bt_SaveCustomInterfaces"
runat
=
"server"
Text
=
"Save Interface"
OnClick
=
"bt_SaveCustomInterfaces_Click"
/>
</
form
>
</
body
>
</
html
>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
public partial class RadDockTest : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
RadDock dock = CreateRadDock();
RadDockZone1.Controls.Add(dock);
}
protected void bt_SaveCustomInterfaces_Click(object sender, EventArgs e)
{
if (RadDockZone2.Docks.Count == 1)
{
foreach (RadDock _radDock in RadDockZone2.Docks)
{
}
}
}
private RadDock CreateRadDock()
{
RadDock dock = new RadDock();
dock.DockMode = DockMode.Docked;
dock.UniqueName = Guid.NewGuid().ToString().Replace("-", "a");
dock.ID = string.Format("RadDock{0}", dock.UniqueName);
dock.Title = "Dock";
dock.Text = string.Format("Added at {0}", DateTime.Now);
dock.Width = Unit.Pixel(300);
dock.Commands.Add(new DockCloseCommand());
dock.Commands.Add(new DockExpandCollapseCommand());
return dock;
}
}