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

onClientClose not working when used in client-side code.

3 Answers 137 Views
Window
This is a migrated thread and some comments may be shown as answers.
Karl Wilkens
Top achievements
Rank 1
Karl Wilkens asked on 05 Nov 2008, 03:20 PM
 Hi,

We are launching a window via client side code as shown below.

 var oWnd = $find("<%= RadWindowManager1.ClientID %>");  
  oWnd.onClientClose = "refreshTree";
  oWnd.show();  
   oWnd.setUrl( "http://www.someURL.com");

This works, the window opens and no errors are thrown.

When the window is closed, I want function refreshTree to fire, but right now it does not. There are no Javascript errors reported by Firefox so I am not sure why this is not working. Any ideas out there?


3 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 05 Nov 2008, 03:22 PM
Hi Karl Wilkens,

The correct syntax is oWnd.add_close(myFunction); where myFunction is the name of the function to be executed.


Regards,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Karl Wilkens
Top achievements
Rank 1
answered on 02 Apr 2009, 01:15 PM
Hi,

I am trying this now with Q1 2009

 var oWnd = $find("<%= RadWindowManager1.ClientID %>");  
  oWnd.show();  
  oWnd.setSize(900,700);  
  oWnd.moveTo(10,120);
  oWnd.add_close("refreshTree()");

and I get this error.
Error: a[b] is not a function
Source File: http://localhost:2344/AlphaAdmin/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_RadScriptManager1_HiddenField&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d1.0.61025.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a1f0f78f9-0731-4ae9-b308-56936732ccb8%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2009.1.311.20%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3a142828f4-5b63-49ab-bd63-3164be3d6118%3a16e4e7cd%3af7645509%3a24ee1bba%3ae330518b%3a1e771326%3ac8618e41%3aaa288e2d%3ae524c98b%3ae4f8f289%3aed16cbdc%3a874f8ea2%3a19620875%3a33108d14%3abd8f85e4
Line: 6

What am I doing wrong?

PS, function refreshTree is empty, just to eliminate the possibility of that being part of the problem. Thanks.

  oWnd.add_close("refreshTree()");




0
Georgi Tunev
Telerik team
answered on 02 Apr 2009, 01:40 PM
Hello again Karl,

As I noted in my previous reply, the add_close() function accepts the name of the function only.
e.g. your code should be:
oWnd.add_close(refreshTree);



Best wishes,
Georgi Tunev
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Window
Asked by
Karl Wilkens
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Karl Wilkens
Top achievements
Rank 1
Share this question
or