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

ClientClose or ClientCallBackFunction

6 Answers 281 Views
Window
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 29 Apr 2008, 11:17 AM
Which of these should I use (I'm using a RadWindow as a dialog).

What's the difference?

--
Stuart

6 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Tunev
Telerik team
answered on 30 Apr 2008, 02:41 PM
Hello Stuart,

Generally speaking they can serve the same purpose - to run a code after a RadWindow is closed and to receive an argument from the dialog. ClientCallBackFunction however will be fired only if there is an argument returned from the dialog while OnClientClose will be fired every time when the RadWindow is closed.
More information on the subject is also available in the documentation, section Controls / RadWindow / Programming / Using RadWindow as a Dialog.




All the best,
Georgi Tunev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Dan
Top achievements
Rank 1
answered on 30 Apr 2008, 02:47 PM
ClientCallBackFunction however will be fired only if there is an argument returned from the dialog while OnClientClose will be fired every time when the RadWindow is closed.
Ah-ha!

I'd changed my code so that a window that used to return a value no longer did. The code was written to invoke ClientCallBackFunction and it stopped working after I'd made the change.

I missed this vital clue in my research.

Cheers Georgi.

--
Stuart
0
Iggy
Top achievements
Rank 1
answered on 26 Jan 2009, 11:15 PM
The release history for the latest version of the Telerik AJAX controls (2008.3.1314) says that the ClientCallbackFunction was made obsolete.  I was just wondering what function, if any, has replaced it or if we just use ClientClose and have to check in the javascript if anything was returned or not.

I checked the ClientCallBackFunction server side and it's marked as obsolete but there are were no XML comments telling which function to use now (which would've been helpful).
0
Georgi Tunev
Telerik team
answered on 27 Jan 2009, 06:42 AM
Hi Iggy,

Indeed, the ClientCallBack function is obsolete from the latest release and you should use OnClientClose. This was done to improve and simplify the RadWindow's code.

Let me know if you experience any problems converting to OnClientClose - I will be glad to help.


Sincerely yours,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Iggy
Top achievements
Rank 1
answered on 27 Jan 2009, 03:48 PM
Can you explain how I return a value now?  I was previously passing the argument as a parameter of the close function, e.g. oWnd.close("Success"); and could then simply read it from the second parameter passed into the ClientCallbackFunction that was specified. 
I remember in previous versions of the window (before the AJAX release) something about setting the return value on another RadWindow property and then reading it from a property when ClientClose was used but I can't find anything about that in the new RadWindow documentation.

Also in the documentation, the Changes and Backward Compatability doesn't say anything about removing the ClientCallbackFunction.

Thanks for the help.
0
Georgi Tunev
Telerik team
answered on 28 Jan 2009, 11:46 AM
Hello Iggy,

We are currently updating the documentation and the demos to use and explain the new logic and the new versions will be updated to our site soon. In the meantime, I attached a small sample to this thread that shows how to use the OnClientClose function to receive the argument. Basically the logic stays the same, the only difference is that there is a second argument in the OnClientClose function from which you can extract the needed value.
e.g. (from the attached example)
function clientClose(sender,args) 
        { 
          if (args.get_argument()!= null
          { 
            alert("'" + sender.get_name() + "'" + " was closed and returned the following argument: '"+ args.get_argument() + "'"); 
            txtInput.value = args.get_argument(); 
          } 
        } 


Greetings,
Georgi Tunev
the Telerik team

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