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

Display pop-up dialog after postback

3 Answers 292 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Paul Haines
Top achievements
Rank 1
Paul Haines asked on 27 Feb 2009, 11:52 AM
I'm developing an AJAXed CompositeControl that, when clicked on, displays a pop-up dialog which requests some information from the user, which is working correctly. When closed I want to then show a second pop-up, (actually a "mailto" link, but I can't show any sort of pop-up here).

I can do a standard postback after the 1st pop-up is closed, but the javascript that I'm injecting doesn't fire at all - regardless if it's just an "alert". If I try to do an "ajax" postback, (using the "GetAjaxEventReference" function), then it either gives me a "null error" of the RadAjaxManager control, or nothing happens, (not even a postback), if I do it via the "Sys.Application.add_load()" function.

Can someone point out what I'm doing wrong, or provide any help in achieving the above?

Thanks,
Paul

3 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 27 Feb 2009, 03:47 PM
Hello Paul,

Please try the suggestions for executing javascript after ajax request from here.
Give a try and let me know if you need further directions help.

Sincerely yours,
Iana
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.
0
Paul Haines
Top achievements
Rank 1
answered on 27 Feb 2009, 04:20 PM
Thank you for that pointer. I had already tried the ScriptManager option, but hadn't noticed the "ResponseScripts" property in the RadAjaxManager, (perhaps this could be referenced in the RadAjaxManager's main documentation?). However, using this code still doesn't run the javascript, so perhaps I should provide a bit more information.

The basic process I had in mind was, (noting that the control has been AJAXed, and is contained within another CompositeControl);
1) User clicks on the CompositeControl.
2) It displays the first "data entry" dialog to obtain some information.
3) User enters the data and presses "OK".
4) The dialog postbacks and closes itself.
5) When it's been closed, the CompositeControl then does a normal postback. (I haven't found a way of performing an "AJAX" postback - see my first post).
6) Finally, add the necessary javascript to display the "email" pop-up, which is subsequently displayed.

Only step (6) doesn't work - as far as I can tell the injected javascript is never run.

The above process has been adapted from various articles I've seen on the internet, and may not be optimal, so if someone can provide a quicker mechanism then I'd be grateful.

Thanks once more,
Paul
0
Accepted
Sebastian
Telerik team
answered on 03 Mar 2009, 11:55 AM
Hello Paul,

Thank you for the detailed explanation.

You can perform an ajax request when the end user hits "OK" and the dialog closes using the ajaxRequest method from the client-side API of RadAjaxManager. Here is how this can be done using RadWindow popup:

http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandwindow/defaultcs.aspx?product=grid (see the sample project from the KB article linked under the Description tab as well)
http://www.telerik.com/support/kb/aspnet-ajax/window/calling-radalert-from-codebehind.aspx

Thus you should be able to use either the ResponseScripts collection of RadAjaxManager or better yet the pageLoaded handler of the ASP.NET AJAX framework (as explained in the help topic linked previously by my colleague Iana) to display another popup window for sending email.

Keep in mind that it is important to mark the RadWindowManager as an updated control through the RadAjaxManager settings.

Kind regards,
Sebastian
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.
Tags
Ajax
Asked by
Paul Haines
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Paul Haines
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or