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

RadDock DockMode

1 Answer 37 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Yet
Top achievements
Rank 1
Yet asked on 29 Aug 2012, 02:25 AM
As i know about DockMode had 3 modes with: default, Docked, & floating..
Is it possible for RadDock to enable drag and reset to default position after client-side loading without postBack?
And any setting to mention for it to reset back to default position?

1 Answer, 1 is accepted

Sort by
0
Dobromir
Telerik team
answered on 31 Aug 2012, 12:40 PM
Hello Yet,

If I understand you correctly, you want to be able to store original position of RadDock before dragging it and restore it at certain point. To do so, you need to handler RadDock's ClientDragStart client-side event and get its top a left position, e.g.:
<telerik:RadDock ID="RadDock1" runat="server" OnClientDragStart="dockDragStart">
    <ContentTemplate>
        Some<br />
        Sample<br />
        Content
    </ContentTemplate>
</telerik:RadDock>
<asp:HiddenField ID="dockPositionHolder" runat="server" />
<asp:Button Text="Restore position" runat="server" OnClientClick="restoreDockPosition(); return false;" />
<script type="text/javascript">
    function dockDragStart(dock, args)
    {
        var posStr = "{\"top\": "+ dock.get_top()+",\"left\": "+dock.get_left()+"}"; //JSON formatted data to be stored
 
        $get("<%=dockPositionHolder.ClientID %>").value = posStr;
    }
 
    function restoreDockPosition()
    {
        var posObj = $telerik.$.parseJSON($get("<%=dockPositionHolder.ClientID %>").value);//get the JSON data as JavaScript object
        var dock = $find("<%=RadDock1.ClientID %>"); //get reference to the RadDock client-side object
 
        if(dock)
        {
            //set dock's original position
            dock.set_top(posObj.top);
            dock.set_left(posObj.left);
        }
    }
</script>


Kind regards,
Dobromir
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
General Discussions
Asked by
Yet
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Share this question
or