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

A dock closed in a callback is not closed at the server on post back

5 Answers 102 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Ivan
Top achievements
Rank 1
Ivan asked on 18 Mar 2009, 11:25 AM
Hi,
I use a dock with a set of custom commands and I use the radconfirm function on one of the command. When calling dock.set_close(true) in the callback of radconfirm the dock is closed in the browser but when I make a post back, the dock is not closed on the server. If i don't use a callback everything is fine.
Here is a test page with this scenario:

Docks.aspx:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Docks.aspx.cs" Inherits="Docks" %> 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!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> 
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
        <script type="text/javascript"
            function closeDock(dock, args){ 
                setTimeout( function(){ dock.set_closed(true);}, 100); 
            } 
        </script> 
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
        <telerik:RadDock ID="dock1" runat="server"
            <Commands> 
                <telerik:DockCommand Name="close" Text="close" OnClientCommand="closeDock" /> 
            </Commands> 
        </telerik:RadDock> 
        <br /> 
        <br /> 
        <br /> 
        <br /> 
        <asp:Button ID="btn1" runat="server" Text="Post back"/> 
        <asp:Label ID="result" runat="server"></asp:Label> 
    </div> 
    </form> 
</body> 
</html> 


Docks.aspx.cs:

using System; 
 
public partial class Docks : System.Web.UI.Page 
    protected void Page_Load(object sender, EventArgs e) 
    { 
        result.Text = string.Empty; 
        btn1.Click += new EventHandler(btn1_Click); 
    } 
 
    void btn1_Click(object sender, EventArgs e) 
    { 
        result.Text = dock1.Closed.ToString(); 
    } 
 

When I closed the dock and click the button the Closed property is still false. If the js function is changed to this:

function closeDock(dock, args){ 
    dock.set_closed(true); 
 

everything is ok. What I want is that the Closed property is true even if I use a callback. Any help would be appreciated.
Thank you,
Ivan Pelovski









5 Answers, 1 is accepted

Sort by
0
Accepted
Petio Petkov
Telerik team
answered on 18 Mar 2009, 02:26 PM
Hi Ivan,

Once you close, expand, collapse etc. a RadDock via JavaScript and you want to preserve the state on postback, you should invoke RadDock.updateClientState() client-side method ($find("RadDock1").updateClientState()).
e.g.
function closeDock(dock, args)  
{    
    dock.set_closed(true);  
    dock.updateClientState();    
}    
 
Let us know if you have any other questions.



Kind regards,
Petio Petkov
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Ivan
Top achievements
Rank 1
answered on 18 Mar 2009, 02:42 PM
Thanks, that worked great. Is this function described in the documentation because I wasn't able to find it there?
Thanks again,
Ivan
0
Petio Petkov
Telerik team
answered on 18 Mar 2009, 03:44 PM
Hi Ivan,

We are currently improving the documentation and the updateClientState method will be included for the next update - thank you for noticing this. Your Telerik points were updated.


Best wishes,
Petio Petkov
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Matt
Top achievements
Rank 1
answered on 18 Mar 2009, 08:12 PM
Can you let us know what other situations require that updateClientState call other than setting closed?  For example, does it need to be called when a dock is docked in an alternate zone or unpinned?
0
Petio Petkov
Telerik team
answered on 19 Mar 2009, 02:31 PM
Hello nowickim,

If you want to preserve the state after postback you should invoke RadDock.updateClientState() method after:
  • RadDock.set_pinned(true/false)
  • RadDock.set_closed(true/false)
  • RadDock.set_collapsed(true/false)

If the dock is manually (with mouse click) closed, collapsed or pinned its new client state will be updated automatically and you don't need to invoke RadDock.updateClientState() method.

Let us know if you have other questions.

Regards,
Petio Petkov
the Telerik team


Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Dock
Asked by
Ivan
Top achievements
Rank 1
Answers by
Petio Petkov
Telerik team
Ivan
Top achievements
Rank 1
Matt
Top achievements
Rank 1
Share this question
or