Radalert from radwindow

6 posts, 0 answers
  1. iomega 55
    iomega 55 avatar
    64 posts
    Member since:
    Dec 2004

    Posted 06 Aug 2009 Link to this post


    I have basepage.aspx in which I have defined scriptmanager and radwindowmanager. In this page I have a link for create a radwindow. In this new radwindow I load myfirstpage.aspx.

    Is there a way for creating from codebehind a radalert window in myfirstpage.aspx, but if the scriptmanager and radwindowmanager are in the basepage.aspx?

    Thanks again.
  2. Georgi Tunev
    Georgi Tunev avatar
    7207 posts

    Posted 06 Aug 2009 Link to this post

    Hello iomega 55,

    The radalert dialog can be called only on the page where the RadWindowManager is. If you want to call it from the codebehind of a content page, you could output some JavaScript that would call top.radalert().
    For example:
    protected void Button1_Click(object sender, EventArgs e) 
        ScriptManager.RegisterStartupScript(thisthis.GetType(), "call_radalert""top.radalert('My Message');"true); 

    More information on how to output JavaScript functions from codebehind is available here.

    Best wishes,
    Georgi Tunev
    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.
  3. Chandu
    Chandu avatar
    4 posts
    Member since:
    May 2010

    Posted 18 Jun 2010 Link to this post

    I am using this code in Button Click Event :


    this.GetType(), "radalert", "window.setTimeout(function(){callAlert('Error','" + objError.strMessage + "');}, 200);", true);  





    Some times it is working fine some time it is getting exception as "Microsoft JScript runtime error: Object expected"

    can u provide solution ?

    Thankx and regards,




  4. Svetlina Anati
    Svetlina Anati avatar
    2795 posts

    Posted 18 Jun 2010 Link to this post

    Hello Chandu,

    The controls in the RadControls for ASP.NET AJAX suite are built upon the MS AJAX framework and the framework itself creates its controls (including RadWindowManager) in the Sys.Application.add_init() method.

    Here is how the client events are fired in the page life cycle:

    window.onload -> Sys.Application.init -> Sys.Application.load

    You can see that the client object representation of MS AJAX controls are created just as the last code on the page in the Sys.Application.init event, which is raised after the window.onload event.

    That is why when you call your code in window.onload by registering the client script, the RadWindowManager will still not be created on the page and you will get an error. To avoid this problem, you can either execute your code with a small timeout, or use the Sys.Application.add_load method.

    You can find additional information about this here:


    That is why what you could do in this case is to choose one of the following options:

    1) Set a bigger timeout which ensures that the manager is already created
    2) Use the Sys.Application.add_load event as explained above

    I hope that the provided explanation and resource are helpful, let me know how it goes.

    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Chandu
    Chandu avatar
    4 posts
    Member since:
    May 2010

    Posted 21 Jun 2010 Link to this post

    Hi Svetlina,

     I used same code what is there in the example given by you,  but that is not satisfied my requirement.still getting error as
    "Microsoft JScript runtime error: Object expected"

    My requirement :

     i am displaying one form in RadWidnow. in that form i have to show server side alert message ('onClick' Event).


  6. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 21 Jun 2010 Link to this post

    Hello Chandra,

    Have you added RadWindowManager on page?

    I tried following code to show RadAlert and it got worked.
    string radalertscript = "<script language='javascript'>function f(){radalert('Welcome to RadWindow <b>Prometheus</b>!', 330, 210); Sys.Application.remove_load(f);}; Sys.Application.add_load(f);</script>";  
    Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript);  

    Here is the KB Article which describes more on this topic:
    Calling radalert from codebehind

    Could you provide the code that you used if this deos not help?

Back to Top