Dynamic RadDock creation problem

4 posts, 0 answers
  1. Jesmon
    Jesmon avatar
    17 posts
    Member since:
    Jul 2012

    Posted 20 Mar 2012 Link to this post

        When I created a dynamic Raddock , showing an error like  "  Telerik.Web.UI.RadDockZone can contain only controls of type Telerik.Web.UI.RadDock " . please help
    Jesmon Joseph
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 20 Mar 2012 Link to this post

    Hello Jesmon,

    Here is the sample code to create RadDock dynamically which worked as expected. Please elaborate your scenario if it doesn't help.
    <telerik:RadDockZone ID="RadDockZone1" runat="server">
    protected void Page_Load(object sender, EventArgs e)
      RadDock dock = new RadDock();
      dock.ID = "dock1";

  3. Jesmon
    Jesmon avatar
    17 posts
    Member since:
    Jul 2012

    Posted 20 Mar 2012 Link to this post

    Hello Shinu,
                        I am using Telerik.Web.Ui version is 2011.1.519.35.   and taking the sample from telerik demo site for creating the dynamic RadDock.  In CreateRadDock() 
                    private RadDock CreateRadDock()
                int docksCount = CurrentDockStates.Count;

                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;

    DockMode showing the error like could not contain the definition for 'DockMode'. same for dock.Commands also
    and I just commented these line and executed then showing the compile error like " Telerik.Web.UI.RadDockZone can contain only controls of type Telerik.Web.UI.RadDock   "
    please help

    Jesmon Joseph
  4. Slav
    Slav avatar
    1359 posts

    Posted 22 Mar 2012 Link to this post

    Hello Jesmon,

    Note that the RadDockZone can contain only RadDock controls. It appears that you are inserting additional elements or controls in the dock zone which results in the encountered error. I would suggest ensuring that you add just a RadDock controls in the RadDockZone. The approach shown in the following code snippet is recommended for docking a dynamically created RadDock:
    RadDockLayout1.Controls.Add(dock); // the RadDock is included in the Controls collection of the RadDockLayout
    dock.Dock(RadDockZone1); // the dock is inserted in a RadDockZone via its method Dock
    This method is used for creating and adding the RadDock controls in the online demo Dock / My Portal.

    Also, keep in mind that you should create the RadDock controls before the event RadDock.DockPositionChanged, in order to ensure their proper operation, as stated in the help article RadDock Lifecycle. Usually, the best place to do thi is Init.

    If you are still unable to resolve the problem after reviewing the presented information, please open a support ticket and send a simple, runnable page that isolates your case so that I can examine it locally and provide a working solution.

    Kind regards,
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top