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

Saving Dock Layout when Dock is resized

6 Answers 110 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Todd
Top achievements
Rank 1
Todd asked on 29 Sep 2008, 06:02 PM
How would I save the RadDockLayout when a RadDock has been resized?
I have it saving when the position changes but I can't seem to get it to save when a dock is resized.

6 Answers, 1 is accepted

Sort by
0
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 30 Sep 2008, 02:31 PM
You can handle the ClientResizeEnd client-side event and create an ajax call with javascript which will save the state on the server.
Hope this helps.
0
Todd
Top achievements
Rank 1
answered on 30 Sep 2008, 04:46 PM
Thanks for your reply.

I do not know javascript.
Do you have an example of how this would be done?
0
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 01 Oct 2008, 03:10 PM
The easiest approach is to add a button to the page with style="display:none" and click it via Javascript when the ResizeEnd event occurs,e.g.
ASPX:
<%@ register tagprefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server">  
    <title>Untitled Page</title> 
    <script type="text/javascript">  
    function DockResizeEnd(obj,args)  
    {  
        $get("MyButton").click();  
    }  
    </script> 
</head> 
<body> 
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
    <div> 
    <telerik:raddocklayout runat="server" id="RadDockLayout1">  
    <telerik:RadDock ID="RadDock1" runat="server" Title="RadDock1"   
    Resizable="true" 
    OnClientResizeEnd="DockResizeEnd">      
    </telerik:RadDock> 
    </telerik:raddocklayout> 
    <asp:Button ID="MyButton" runat="server" Text="SaveStateOnServer" style="display:none" OnClick="MyButton_Click"/>  
    </div> 
    </form> 
</body> 
</html> 
 
In the Button_Click handler(on the server) you should add you logic which will save the state,
0
Todd
Top achievements
Rank 1
answered on 01 Oct 2008, 07:13 PM
Thank you for your reply.

Although this does work it causes a post back because of the button being clicked. Is there a way to do it without postback?

I wonder why something like this was not coded into the control, seems like you would always want to save the layout after a dock is resized.
0
Obi-Wan Kenobi
Top achievements
Rank 1
answered on 02 Oct 2008, 12:50 PM
You can use RadDock's doPostBack client-side method ,e.g.

<

script type="text/javascript">
function DockResizeEnd(dockObj,args)

    dockObj.doPostBack(
'DockPositionChanged');
}
</script>

0
Todd
Top achievements
Rank 1
answered on 02 Oct 2008, 01:03 PM
That works perfectly.
Thanks for your help.
Tags
Dock
Asked by
Todd
Top achievements
Rank 1
Answers by
Obi-Wan Kenobi
Top achievements
Rank 1
Todd
Top achievements
Rank 1
Share this question
or