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 / Set Drag Handle Client-side

 
RadDock1
 
 
You can drag this object through the titlebar, no custom handle is defined.
 
     
 
RadDock2
 
 
Image
You can drag this object using the image above.
 
     
   
 
You cannot drag this object as the property dockhandle is set to None and acustom handle is not defined.
 
     
   
 
Image
You can drag this object using the image above.
 
     
     
 
You can drag this object through the grip, no custom handle is defined.
 
     
     
 
You can drag this object using the text below:

DRAG HERE
 
     

  • Set Dock Handle

    The RadDock control can be dragged using Grips or TitleBar depending on the DockHandle property. Furthermore, client-side you can set an element within the content of RadDock to be recognized as the drag element instead of the titlebar and grips. This is possible through RadDock object's client-side method set_handle.

    To set a dock handle, follow the steps below:

    1) Set the content of the RadDock object:

    <telerik:raddock id="RadDock4" runat="server">
    <contenttemplate>
    You can drag this object using the image below:
    <img id="HandleImage4" src="../Skinning/Thumbnails/Blue.gif" alt="Image" />
    </contenttemplate>
    </telerik:raddock>

    2) Handle onclientinitialize of RadDock - in the handler function get reference to your RadDock object and also the object within RadDock's template that you would like to set as a dock handle. Then, use set_handle method to set the RadDock's new handle element.

Source Code

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

    <%@ 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" />
        <style type="text/css">
        .RadDockZone
        {
            border-width:0px !important;
        }
        </style>
    </head>
    <body class="BODY">
        <form id="Form1" method="post" runat="server">
            <qsf:Header ID="Header1" runat="server" NavigationLanguage="VB" />
            <telerik:RadScriptManager ID="ScriptManager" runat="server" />

            <script type="text/javascript">
            function SetHandleDock(dock, args)
            {
                dock.set_handle(document.getElementById("Handle_" + dock.get_id()));
            }
            </script>

            <telerik:RadDockLayout runat="server" ID="RadDockLayout1">
                <table style="width: 757px; height: 352px;">
                    <tr>
                        <td style="padding-left: 125px; padding-top: 20px; vertical-align:top;">
                            <telerik:RadDockZone runat="server" style="background: url(Img/bg.gif)"
                                ID="RadDockZone1" Orientation="Vertical" MinHeight="300px" Width="200px">
                                <telerik:RadDock ID="RadDock1" Title="RadDock1" runat="server" Width="200px">
                                    <ContentTemplate>
                                        <div style="padding: 11px;">
                                            You can drag this object through the titlebar, no custom handle is defined.</div>
                                    </ContentTemplate>
                                </telerik:RadDock>
                                <telerik:RadDock ID="RadDock2" Title="RadDock2" runat="server" Width="200px" OnClientInitialize="SetHandleDock">
                                    <ContentTemplate>
                                        <div style="padding: 11px; text-align: center;">
                                            <img id="Handle_RadDock2" alt="Image" src="Img/drag.gif" style="cursor: move;" /><br />
                                            You can drag this object using the image above.
                                        </div>
                                    </ContentTemplate>
                                </telerik:RadDock>
                            </telerik:RadDockZone>
                        </td>
                        <td style="vertical-align:top; padding-top: 20px;">
                            <telerik:RadDockZone style="background: url(Img/bg.gif)"
                                runat="server" ID="RadDockZone2" Orientation="Vertical" MinHeight="300px" Width="200px">
                                <telerik:RadDock ID="RadDock3" Title="RadDock3" runat="server" Width="200px" DockHandle="None">
                                    <ContentTemplate>
                                        <div style="padding: 11px;">
                                            You cannot drag this object as the property dockhandle is set to None and acustom
                                            handle is not defined.</div>
                                    </ContentTemplate>
                                </telerik:RadDock>
                                <telerik:RadDock ID="RadDock4" Title="RadDock4" runat="server" Width="200px" DockHandle="None"
                                    OnClientInitialize="SetHandleDock">
                                    <ContentTemplate>
                                        <div style="padding: 11px; text-align: center;">
                                            <img id="Handle_RadDock4" alt="Image" src="Img/drag.gif" style="cursor: move;" /><br />
                                            You can drag this object using the image above.
                                        </div>
                                    </ContentTemplate>
                                </telerik:RadDock>
                            </telerik:RadDockZone>
                        </td>
                        <td style="padding-right: 36px; padding-top: 20px; vertical-align:top;">
                            <telerik:RadDockZone style="background: url(Img/bg.gif)"
                                runat="server" ID="RadDockZone3" Orientation="Vertical" MinHeight="300px" Width="200px">
                                <telerik:RadDock ID="RadDock5" Title="RadDock5" runat="server" Width="200px" DockHandle="Grip">
                                    <ContentTemplate>
                                        <div style="padding: 11px;">
                                            You can drag this object through the grip, no custom handle is defined.</div>
                                    </ContentTemplate>
                                </telerik:RadDock>
                                <telerik:RadDock ID="RadDock6" Title="RadDock6" runat="server" Width="200px" DockHandle="Grip"
                                    OnClientInitialize="SetHandleDock">
                                    <ContentTemplate>
                                        <div style="padding: 11px; text-align: center;">
                                            You can drag this object using the text below:<br />
                                            <br />
                                            <div id="Handle_RadDock6" style="text-align: center; cursor: move;">
                                                <b>DRAG HERE</b></div>
                                        </div>
                                    </ContentTemplate>
                                </telerik:RadDock>
                            </telerik:RadDockZone>
                        </td>
                    </tr>
                </table>
            </telerik:RadDockLayout>
            <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