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

Expand only 1 RadDock at a time

1 Answer 37 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Richard M
Top achievements
Rank 1
Richard M asked on 12 Aug 2010, 07:25 PM
How can I programatically or thru Javascript open only 1 RadDock at a time?

1 Answer, 1 is accepted

Sort by
0
Petio Petkov
Telerik team
answered on 13 Aug 2010, 05:02 PM
Hello Richard M,

You should write custom JavaScript code, which will collapse all other RadDocks when you expand 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() == false)
                {  
                    for (var i = 0; i < allDocks.length; i++)
                    {
                        if (allDocks[i] != dock)
                        {
                            allDocks[i].set_collapsed(true);
                        }
                          
                    }
                }
            }
        }
    </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"
                Collapsed="true">  
                </telerik:RadDock>  
                <telerik:RadDock ID="RadDock2" runat="server" Text="RadDock2" DockMode="Docked" OnClientCommand="DockCommand" OnClientInitialize="DockInit"
                Collapsed="true">  
                </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>



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
Richard M
Top achievements
Rank 1
Answers by
Petio Petkov
Telerik team
Share this question
or