Collapse only one dock at a time

2 posts, 0 answers
  1. Richard M
    Richard M avatar
    76 posts
    Member since:
    Mar 2010

    Posted 09 Aug 2010 Link to this post

    Is there a way to only have one RadDock collapsed at a time?
  2. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 10 Aug 2010 Link to this post

    Hi Richard M,

    You should write custom JavaScript code, which will expand all other RadDocks when you collapse one of them, e.g.
    <%@ 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 id="Head1" runat="server">
        <title></title>
        <script type="text/javascript">
            var allDocks = [];
            function DockInit(dock, args)
            {
                allDocks[allDocks.length] = dock;
            }
            function DockCommand(dock, args)
            {
                var commandName = args.command.get_name();
                if (commandName = "ExpandCollapse")
                {
                    if (dock.get_collapsed() == true)
                    {  
                        for (var i = 0; i < allDocks.length; i++)
                        {
                            if (allDocks[i] != dock)
                            {
                                allDocks[i].set_collapsed(false);
                            }
                              
                        }
                    }
                }
            }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <div>
            <telerik:RadDockLayout ID="RadDockLayout1" runat="server">
               <telerik:RadDockZone ID="RadDockZone1" runat="server" UniqueName="RadDockZone1">  
                    <telerik:RadDock ID="RadDock1" runat="server" Text="RadDock1" DockMode="Docked" OnClientCommand="DockCommand" OnClientInitialize="DockInit">  
                    </telerik:RadDock>  
                    <telerik:RadDock ID="RadDock2" runat="server" Text="RadDock2" DockMode="Docked" OnClientCommand="DockCommand" OnClientInitialize="DockInit">  
                    </telerik:RadDock>  
                    <telerik:RadDock ID="RadDock3" runat="server" Text="RadDock3" DockMode="Docked" OnClientCommand="DockCommand" OnClientInitialize="DockInit">  
                    </telerik:RadDock>  
                </telerik:RadDockZone>  
                <telerik:RadDockZone ID="RadDockZone2" runat="server" UniqueName="RadDockZone2">  
                </telerik:RadDockZone>  
      
            </telerik:RadDockLayout>
          
        </div>
        </form>
    </body>
    </html>



    Regards,
    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top