
Timothy Faase
Top achievements
Rank 1
Timothy Faase
asked on 24 Feb 2012, 04:11 AM
Hi there,
I am keen to (confirm('If someone actually wants to delete their dock?'))
But it seems DockCloseCommand client side command fires after it's been closed??
I am keen to (confirm('If someone actually wants to delete their dock?'))
But it seems DockCloseCommand client side command fires after it's been closed??
3 Answers, 1 is accepted
0
Hi Timothy,
Slav
the Telerik team
Note that the closing of a RadDock control cannot be canceled when its Close command is used. My suggestion is to create custom command with the same functionality as the Close command and then to use client-side script to close the RadDock if confirmed.
Below is an example of adding DockCommand to the Commands collection of RadDock and attaching a client-side event handler, which implements the custom command logic:
<!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
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
>
</
asp:ScriptManager
>
<
script
type
=
"text/javascript"
>
function ClientCommand(sender, args) {
if (args.Command.get_name() == "CustomClose") { // check if this is the custom Close command
var closed = confirm("Are you sure?");
sender.set_closed(closed); // set_closed method of RadDock client-side object is used to close the control
args.set_cancel(!closed); // this method will cancel the server-side event if the RadDock close isn't confirmed, the condition under which you cancel it depends on your custom scenario
}
}
</
script
>
<
telerik:RadDockLayout
ID
=
"RadDockLayout1"
runat
=
"server"
>
<
telerik:RadDockZone
ID
=
"RadDockZone1"
runat
=
"server"
Height
=
"300px"
Width
=
"300px"
>
<
telerik:RadDock
ID
=
"RadDock1"
runat
=
"server"
Width
=
"300px"
OnClientCommand
=
"ClientCommand"
Title
=
"RadDock"
Text
=
"Content"
>
<
Commands
>
<
telerik:DockCommand
Name
=
"CustomClose"
Text
=
"Close"
CssClass
=
"rdClose"
/> <%--the custom Close command, it uses the CSS class of Close command--%>
</
Commands
>
</
telerik:RadDock
>
</
telerik:RadDockZone
>
</
telerik:RadDockLayout
>
</
div
>
</
form
>
</
body
>
</
html
>
Feel free to contact us again if you run into more difficulties.
Slav
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.
0

Timothy Faase
Top achievements
Rank 1
answered on 28 Feb 2012, 10:37 PM
Hi Slav,
Any clues to why this event doesn't fire? I have tried the above, also including:
Could another event be overriding it?
Any clues to why this event doesn't fire? I have tried the above, also including:
<
telerik:DockCommand
Name
=
"CustomClose"
Text
=
"Close"
CssClass
=
"rdClose"
OnClientCommand
=
"ClientCommand"
/>
Could another event be overriding it?
0
Hi Timothy,
Please ensure that the handler of the client-side event OnClientCommand is attached correctly. You can check this help article on the matter.
I have attached a sample project, demonstrating the suggested approach, so that you can compare it with you actual project and check if there are differences in the setup.
If you are still unable to resolve the issue, please modify the attached sample so that the described behavior can be reproduced, open a support ticket and send it so that I can examine your scenario locally and suggest an according solution.
Kind regards,
Slav
the Telerik team
Please ensure that the handler of the client-side event OnClientCommand is attached correctly. You can check this help article on the matter.
I have attached a sample project, demonstrating the suggested approach, so that you can compare it with you actual project and check if there are differences in the setup.
If you are still unable to resolve the issue, please modify the attached sample so that the described behavior can be reproduced, open a support ticket and send it so that I can examine your scenario locally and suggest an according solution.
Kind regards,
Slav
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.