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

RadWindow autosize on ajax response

1 Answer 42 Views
Window
This is a migrated thread and some comments may be shown as answers.
Jorge
Top achievements
Rank 1
Jorge asked on 11 Jun 2010, 03:37 PM
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!


1 Answer, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 16 Jun 2010, 02:03 PM
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.
Tags
Window
Asked by
Jorge
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Share this question
or