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

Removing the right click from the drag handle

1 Answer 50 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Damien
Top achievements
Rank 1
Damien asked on 16 Nov 2010, 07:35 AM
Hi,

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.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 19 Nov 2010, 08:14 AM
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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="RadScriptManager1" runat="server">
    </asp:ScriptManager>
    <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
 
                args.set_cancel(true);
            }
            else
            {
                //Any other button was clicked
            }
        }
        function OnClientDockPositionChanged(dock, args)
        {
            alert("OnClientDockPositionChanged fired!");
        }
    </script>
    <div>
        <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">
                    <ContentTemplate>
                        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
                        mus.
                    </ContentTemplate>
                </telerik:RadDock>
            </telerik:RadDockZone>
        </telerik:RadDockLayout>
    </div>
    </form>
</body>
</html>


Greetings,
Pero
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.
Tags
Dock
Asked by
Damien
Top achievements
Rank 1
Answers by
Pero
Telerik team
Share this question
or