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


    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?

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

  4. 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..
  5. Marin Bratanov
    Marin Bratanov avatar
    3899 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:

    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:

    Best wishes,
    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