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

Can we add DockZone control to a page at runtime

1 Answer 46 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Deepak
Top achievements
Rank 1
Deepak asked on 20 Jul 2010, 10:46 AM
I have a requirment, I need to have a dropdown list which will contains values form 1 to 4.
Based on what user selects from it, I need to add same number  Dockzone control to my asp.net page.

I want to know is it possible to do, I did add Dock controls at the runtime and they are working fine on another page.
But i am not sure about the dockzone controls.

1 Answer, 1 is accepted

Sort by
0
Petio Petkov
Telerik team
answered on 22 Jul 2010, 03:19 PM
Hello Deepak,

You can add RadDockZones dynamically. Here it is a simple example:
ASPX:
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head runat="server">
    <title></title>
     
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <div>
    <asp:DropDownList ID="ddList1" runat="server" AutoPostBack="true" 
            onselectedindexchanged="ddList1_SelectedIndexChanged">
        <asp:ListItem Text="1" Value="1"></asp:ListItem>
        <asp:ListItem Text="2" Value="2"></asp:ListItem>
        <asp:ListItem Text="3" Value="3"></asp:ListItem>
        <asp:ListItem Text="4" Value="4"></asp:ListItem>
    </asp:DropDownList>
    <telerik:RadDockLayout ID="RadDockLayout1" runat="server">
       <asp:Panel ID="Panel1" runat="server"></asp:Panel>
    </telerik:RadDockLayout>
    </div>
      
    </form>
</body>
</html>
Codebehind:
protected void ddList1_SelectedIndexChanged(object sender, EventArgs e)
   {
       int zonesCount = int.Parse(ddList1.SelectedValue);
       for (int i = 0; i < zonesCount; i++)
       {
           RadDockZone zone = new RadDockZone();
           zone.ID = "RadDockZone" + i.ToString();
           Panel1.Controls.Add(zone);
       }
   }


Greetings,
Petio Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Dock
Asked by
Deepak
Top achievements
Rank 1
Answers by
Petio Petkov
Telerik team
Share this question
or