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

6 posts, 1 answers
  1. Ivan
    Ivan avatar
    19 posts
    Member since:
    Jan 2008

    Posted 18 Mar 2009 Link to this post

    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









  2. Answer
    Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 18 Mar 2009 Link to this post

    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.
  3. Ivan
    Ivan avatar
    19 posts
    Member since:
    Jan 2008

    Posted 18 Mar 2009 Link to this post

    Thanks, that worked great. Is this function described in the documentation because I wasn't able to find it there?
    Thanks again,
    Ivan
  4. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 18 Mar 2009 Link to this post

    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.
  5. Matt
    Matt avatar
    16 posts
    Member since:
    Aug 2007

    Posted 18 Mar 2009 Link to this post

    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?
  6. Petio Petkov
    Admin
    Petio Petkov avatar
    825 posts

    Posted 19 Mar 2009 Link to this post

    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.
Back to Top