Using Predefined Dialogs with Codebehind

5 posts, 0 answers
  1. John Esposito
    John Esposito avatar
    11 posts
    Member since:
    Oct 2009

    Posted 23 Mar 2010 Link to this post

    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,
  2. robertw102
    robertw102 avatar
    265 posts
    Member since:
    Jul 2007

    Posted 25 Mar 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. John Esposito
    John Esposito avatar
    11 posts
    Member since:
    Oct 2009

    Posted 25 Mar 2010 Link to this post

    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).

  5. cheekl
    cheekl avatar
    55 posts
    Member since:
    Jul 2012

    Posted 03 Jul 2011 Link to this post

    Does it work for radbutton onClick event? I tried and not able to see the expected result..
  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3602 posts

    Posted 04 Jul 2011 Link to this post

    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.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017