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

URGENT: DockCloseCommand's OnClientCommand does not fire

1 Answer 34 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 14 Sep 2009, 08:13 PM

Everything was working fine. We've upgraded to 2009.1.527.35 and it broke the close command on docs.

 

 

DockCloseCommand objDockCloseCommand = new DockCloseCommand();

 

objDockCloseCommand.OnClientCommand =

"dockClose_Click";

 

objDockCloseCommand.Text =

"Close";

 

currentDock.Commands.Add(objDockCloseCommand);

 

 

function dockClose_Click() {

 

//this never gets executed
alert(

'test');

 

}

Funny part about it is that if dockClose_Click does not exist I get an error when page loads.
Please help, this is urgent.

1 Answer, 1 is accepted

Sort by
0
Pero
Telerik team
answered on 15 Sep 2009, 06:03 AM
Hello Martin,

This is a known problem with the 2009.1.527 version of the RadDock control. In some of the previous versions we added animations and If you set the RadDock's EnableAnimation property to false (by default is false) the event for the close command will not be fired. The problem is fixed and I recommend that you upgrade to the latest version available. However, if you decide to stay with the 2009.1 527 version you can workaround this issue by overriding the set_closed method as is shown below:

<%@ 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 id="Head1" runat="server"
    <title>Untitled Page</title> 
 
    <script type="text/javascript"
        function DockCommand(obj, args) 
        { 
            alert("handler"); 
        }   
    </script> 
 
</head> 
<body> 
    <form id="form1" runat="server"
    <asp:ScriptManager ID="ScriptManager1" runat="server"
    </asp:ScriptManager> 
    <asp:Button runat="server" Text="Postback" /> 
    <div> 
        <asp:Label ID="Label1" runat="server"></asp:Label> 
        <telerik:RadDockLayout ID="RadDockLayout1" runat="server"
            <telerik:RadDockZone ID="RadDockZone1" runat="server"
                <telerik:RadDock ID="RadDock1" runat="server"
                    <Commands> 
                        <telerik:DockCloseCommand OnClientCommand="DockCommand" /> 
                    </Commands> 
                </telerik:RadDock> 
            </telerik:RadDockZone> 
        </telerik:RadDockLayout> 
    </div> 
    </form> 
 
    <script type="text/javascript"
        //FIX the problem when dock is without animation.   
        var old_SetClosed = Telerik.Web.UI.RadDock.prototype.set_closed; 
        Telerik.Web.UI.RadDock.prototype.set_closed = function(value, playAnimation) 
        { 
            if (value == true) 
            { 
                this._closed = value
                var element = this.get_element(); 
                element.style.display = "none"
                this.updateClientState(); 
                Telerik.Web.UI.DockCloseCommand.callBaseMethod(this.getCommand("Close"), 'onCommand'); 
            } 
            else 
            { 
                old_SetClosed(value, playAnimation); 
            } 
        }   
    </script> 
 
</body> 
</html> 



Regards,
Pero
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Dock
Asked by
Martin
Top achievements
Rank 1
Answers by
Pero
Telerik team
Share this question
or