How to Change RadDockZone Width and height during Runtime in javascript

2 posts, 0 answers
  1. dinesh reddy
    dinesh reddy avatar
    1 posts
    Member since:
    Dec 2009

    Posted 27 Apr 2010 Link to this post

    Hi Everyone,
    My problem goes like these.
    i ve two dockzone of different height and width based on raddocks in them.
    when i drag and drop the dock from one webzone to other, these works fine.
    along with these i need to exchange two dockzones height and width whilei drag and drop docks.
    Do suggest.

  2. Pero
    Pero avatar
    1156 posts

    Posted 29 Apr 2010 Link to this post

    Hello Dinesh,

    There is no built-in client-side functionality that will resize the DockZone. This can be done on the server only.

    Here is a work around that will exchange the width and height of two DockingZones, but please note that, these changes will not be persisted after a postback:
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <head id="Head1" runat="server">
        <telerik:RadScriptBlock ID="RadCodeBlock1" runat="server">
            <script type="text/javascript">
                function ChangeWidth()
                    var dockZone = $telerik.findDockZone("<%=RadDockZone1.ClientID %>");
                    dockZone.get_element().style.height = 600;
                    // = 600;
                var originalZoneID = "";
                var originalIndex = "";
                function OnClientDragStart(dock, args)
                    originalZoneID = dock.get_dockZoneID();
                    originalIndex = dock.get_index();
                function OnClientDockPositionChanged(dock, args)
                    var currentZone = dock.get_dockZone();
                    var currentIndex = dock.get_index();
                    var docks = currentZone.get_docks();
                    if (currentZone.get_id() != originalZoneID)
                        var originalZoneElement = $find(originalZoneID).get_element();
                        var currentZoneElement = currentZone.get_element();
                        var originalZone_MinHeight =;
                        var originalZone_Height =;
                        var originalZone_Width =;
               = originalZone_MinHeight;
               = originalZone_Height;
               = originalZone_Width;
        <style type="text/css">
                float: left;
                margin-right: 10px;
            .rdTitleBar EM
                width: 100% !important;
                position: absolute !important;
                right: 7px !important;
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
                <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" />
            <asp:Button ID="Button1" runat="server" Text="Postback" />
            <input type="button" value="Set Width" onclick="ChangeWidth(); return false;" />
            <telerik:RadDockLayout ID="RadDockLayout1" runat="server">
                <telerik:RadDockZone ID="RadDockZone1" runat="server" MinHeight="300px" Width="300px">
                    <telerik:RadDock ID="RadDock1" runat="server" Title="RadDock-Title" Width="300px"
                        Skin="Hay" DockMode="Docked" OnClientDragStart="OnClientDragStart" OnClientDockPositionChanged="OnClientDockPositionChanged">
                            <br />
                            <br />
                            <br />
                            <br />
                            <br />
                            <br />
                            <br />
                            <br />
                            <br />
                            <br />
                <telerik:RadDockZone ID="RadDockZone2" runat="server" MinHeight="200px" Width="600px">

    This can be easily done in the code behind by handling the DockPositionaChanged event and setting the AutoPostBack property to true. The original zone ID should be retrieved at Page.Init using the dock.DockZoneID property, before the new zone ID is applied.

    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.
Back to Top