Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
Version Q2 2011 released 07/12/2011
select

Dock / Commands

Please, click a command button from the titlebar of the dock.
 
ExpandCollapse + Close
 
 
  • Click the Collapse/Expand button on the title bar to toggle the content of the object.
  • Click the Close button on the title bar to close the object.
 
     
 
Custom Commands + Close
 
 
  • Click the first or the second icon in the titlebar to see the action of the custom commands.
  • Click the Close button on the title bar to close the object.
 
     
Event Log:
 
PinUnpin + Close
 
 
  • Click the Pin/Unpin button on the title bar to disable/enable the ability to drag the object.
  • Click the Close button on the title bar to close the object.
 
     

  • Commands

    RadDock Command is a button which appears in the top right corner of the RadDock titlebar. Each command can optionally perform postback. RadDock provides the Command event, which is fired when a command was clicked on the client.

    RadDock comes with three integrated commands: ExpandCollapse, Close and PinUnpin. By default they will be displayed in the titlebar, unless you modify the DefaultCommands property, or the Commands collection.

    You can easily create custom commands by adding DockCommand objects to the Commands collection. If you want to encapsulate functionality, you may inherit from DockCommand and provide new default values for the existing properties, or add new properties, which will be sent to the client-side object.

Source Code

C# VB.NET
Show code in new window Demo isolation steps
  • <%@ Page Language="c#" AutoEventWireup="true" Inherits="Telerik.Web.Examples.Dock.Commands.DefaultCS"
        CodeFile="DefaultCS.aspx.cs" %>

    <%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
    <%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
    <%@ Register TagPrefix="qsf" TagName="Header" Src="~/Common/Header.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="HeadTag" Src="~/Common/HeadTag.ascx" %>
    <%@ Register TagPrefix="qsf" TagName="Footer" Src="~/Common/Footer.ascx" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <qsf:HeadTag ID="Headtag1" runat="server" />
        <!--[if lte IE 6]>
        <style type="text/css">
        .raddockzone{width:220px;height:300px}
        </style>
        <![endif]-->
        <style type="text/css">
            td
            {
                vertical-align: top;
            }
        </style>
    </head>
    <body class="BODY">
        <form id="Form1" method="post" runat="server">
        <qsf:Header ID="Header1" runat="server" NavigationLanguage="c#" />
        <telerik:RadScriptManager ID="ScriptManager" runat="server" />
        <qsf:InformationBox ID="InformationBox1" runat="server">
            Please, click a command button from the titlebar of the dock.
        </qsf:InformationBox>
        <telerik:RadDockLayout runat="server" ID="RadDockLayout1">
            <table>
                <tr>
                    <td>
                        <telerik:RadDockZone runat="server" ID="RadDockZone1" MinHeight="300" Width="400">
                            <telerik:RadDock runat="server" ID="RadDock1" Title="ExpandCollapse + Close" EnableRoundedCorners="true">
                                <ContentTemplate>
                                    <ul>
                                        <li>Click the Collapse/Expand button on the title bar to toggle the content of the object.</li>
                                        <li>Click the Close button on the title bar to close the object.</li>
                                    </ul>
                                </ContentTemplate>
                            </telerik:RadDock>
                            <telerik:RadDock runat="server" ID="RadDock3" Title="Custom Commands + Close" OnCommand="RadDock_Command"
                                EnableRoundedCorners="true">
                                <Commands>
                                    <telerik:DockCloseCommand />
                                    <telerik:DockCommand AutoPostBack="true" Name="Simple Custom Command" />
                                    <telerik:DockCommand AutoPostBack="true" Name="Custom Command" OnClientCommand="CustomCommand" />
                                </Commands>
                                <ContentTemplate>
                                    <ul>
                                        <li>Click the first or the second icon in the titlebar to see the action of the custom
                                            commands.</li>
                                        <li>Click the Close button on the title bar to close the object.</li>
                                    </ul>
                                </ContentTemplate>
                            </telerik:RadDock>
                        </telerik:RadDockZone>
                    </td>
                    <td>
                        <telerik:RadDockZone runat="server" ID="RadDockZone2" MinHeight="300" Width="400">
                        </telerik:RadDockZone>
                    </td>
                </tr>
            </table>
              <qsf:EventLogConsole ID="EventLogConsole1" runat="server" Title="Event Log:"/>
            <telerik:RadDock runat="server" ID="RadDock2" DefaultCommands="PinUnpin,Close" Title="PinUnpin + Close"
                Top="220px" Left="820px" EnableRoundedCorners="true">
                <ContentTemplate>
                    <ul>
                        <li>Click the Pin/Unpin button on the title bar to disable/enable the ability to drag
                            the object.</li>
                        <li>Click the Close button on the title bar to close the object.</li>
                    </ul>
                </ContentTemplate>
            </telerik:RadDock>
        </telerik:RadDockLayout>

        <script type="text/javascript">
            function CustomCommand(dock, args)
            {
                //You can implement your custom logic in this method
                if (!confirm("You clicked " + args.Command.get_name() + ". Do you want to submit the page?"))
                {
                    args.set_cancel(true);
                }
            }
        </script>

        <qsf:Footer runat="server" ID="Footer1" ShowCodeViewer="true" />
        </form>
    </body>
    </html>

Get more than expected!

 
 

Take your time to truly experience the power of RadControls for ASP.NET AJAX with a free 60-day trial backed up by Telerik’s unlimited dedicated support.

Download your RadControls for ASP.NET AJAX trial and jumpstart your development with the available Getting Started resources.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Copyright 2002-2024 © Telerik. All right reserved
Telerik Inc, 201 Jones Rd, Waltham, MA 02451