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

Using Predefined Dialogs with Codebehind

4 Answers 95 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
John Esposito
Top achievements
Rank 1
John Esposito asked on 23 Mar 2010, 04:36 PM
Hello,

I can easily display a radalert dialog from my C# codebehind with the following line of code:

RadAjaxManager1.ResponseScripts.Add(@"radalert('Record already exists.', 225, 110);"); 

I assumed that working with the confirm and prompt dialogs would be similar, so I tried the following:

RadAjaxManager1.ResponseScripts.Add(@"radprompt('Are you sure?', promptCallBackFn;"); 

But I cannot get the radprompt to even display (at this point I am only concerned with displaying the prompt). Am I wrong in assuming that I can treat these dialogs identically?

Thanks,

4 Answers, 1 is accepted

Sort by
0
robertw102
Top achievements
Rank 1
answered on 25 Mar 2010, 03:11 PM
I noticed in your code that you did not add the closing bracket for the radprompt call. I'm assuming that's the reason it's not showing.
0
John Esposito
Top achievements
Rank 1
answered on 25 Mar 2010, 04:18 PM
Thank you for catching that robertw. I accidentally deleted it after removing all optional arguments for the dialog. Instead of nothing happening when I try to display the dialog I now get an "error on page" message in the browser's message area. The search continues.

It's odd because in my testing I'm only replacing the radalert call, which works fine, with the radprompt call. If the two should be handled differently, I can't find any reference to it in the documentation. (To anticipate another question: I do have a promptCallBackFn properly defined in my code).

0
cheekl
Top achievements
Rank 2
answered on 04 Jul 2011, 03:05 AM
Does it work for radbutton onClick event? I tried and not able to see the expected result..
0
Marin Bratanov
Telerik team
answered on 04 Jul 2011, 12:16 PM
Hi Cheekl,

You need to specify the correct syntax of the function as shown in the following articles:
http://www.telerik.com/help/aspnet-ajax/window-dialogs-alert.html
http://www.telerik.com/help/aspnet-ajax/window-dialogs-confirm.html
http://www.telerik.com/help/aspnet-ajax/window-dialogs-prompt.html

On the other hand, I would suggest that you use the server-side methods to call these dialogs, which are available since Q1 2011. You can see them in action in the following online demo as well: http://demos.telerik.com/aspnet-ajax/window/examples/browserdialogboxes/defaultcs.aspx.


Best wishes,
Marin
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Ajax
Asked by
John Esposito
Top achievements
Rank 1
Answers by
robertw102
Top achievements
Rank 1
John Esposito
Top achievements
Rank 1
cheekl
Top achievements
Rank 2
Marin Bratanov
Telerik team
Share this question
or