Removing the right click from the drag handle

2 posts, 0 answers
  1. Damien
    Damien avatar
    1 posts
    Member since:
    Aug 2010

    Posted 16 Nov 2010 Link to this post


    I'm wanting to use some context based code on a RadDock drag handle but when I hookup my javascript to the right click/oncontextmenu that works great but the dock fires off the OnClientDockPositionChanged event. Can anyone help me in removing the handler from the right mouse button/oncontextmenu so the dock does not fire off the extra events.

  2. Pero
    Pero avatar
    1156 posts

    Posted 19 Nov 2010 Link to this post

    Hi Damien,

    You should handle the dragStart client-side event of the RadDock, and based on the mouse button clicked, open a context menu and cancel the drag. Here is the code demonstrating this approach:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
    <head runat="server">
        <form id="form1" runat="server">
        <asp:ScriptManager ID="RadScriptManager1" runat="server">
        <script type="text/javascript">
            function OnClientDragStart(dock, args)
                var event = args.ownerEvent;
                if (event.button == 2)
                    //Right button was clicked execute your logic and cancel the movement
                    //Any other button was clicked
            function OnClientDockPositionChanged(dock, args)
                alert("OnClientDockPositionChanged fired!");
            <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"
                        OnClientDragStart="OnClientDragStart" OnClientDockPositionChanged="OnClientDockPositionChanged">
                            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut eu leo quis felis eleifend
                            congue id ac nulla. Suspendisse in sapien eu tortor aliquam luctus. Suspendisse
                            pretium, nulla sit amet porttitor lobortis, ante sapien blandit ante, et tempor
                            magna eros nec sapien. In hac habitasse platea dictumst. Nullam a quam lorem, eu
                            vestibulum turpis. Praesent a neque et diam tincidunt suscipit ut semper massa.
                            Vivamus posuere, mi eu consectetur consequat, libero risus accumsan erat, ut facilisis
                            dolor justo a enim. Donec suscipit tincidunt lorem, sed aliquam velit pulvinar euismod.
                            Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus

    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top