RadWindow autosize on ajax response

2 posts, 0 answers
  1. Jorge
    Jorge avatar
    53 posts
    Member since:
    Jun 2009

    Posted 11 Jun 2010 Link to this post

    In server-side I do some validation and then show a radwindow. If this code is sent via a normal request, the autosize feature works, but it i sent via ajax then it doesn't

    string script = @"var oWindowMsg = top.window.radopen('Hello World', null);
                                    oWindowMsg.setSize(200, 200);
                                    oWindowMsg.set_modal(true);
                                    oWindowMsg.set_visibleStatusbar(false);
                                    oWindowMsg.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close);
                                    oWindowMsg.add_pageLoad(function () { oWindowMsg.autoSize(true) });"
                    
    if (RadScriptManager.GetCurrent(this).IsInAsyncPostBack) 
      RadAjaxManager.GetCurrent(this).ResponseScripts.Add(script); 
    else 
      this.ClientScript.RegisterStartupScript(this.GetType(), "mostrarMensaje", String.Format("<script language='javascript'>function f(){{{0}; Sys.Application.remove_load(f);}}; Sys.Application.add_load(f);</script>", script)); 
     

    Any idea? Thanks!


  2. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 16 Jun 2010 Link to this post

    Hello Jorge,

    I recommend you to use the ScriptManager's RegisterStartupScript static method. More details about this method can be found in this MSDN article.


    Sincerely yours,
    Fiko
    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.
Back to Top