
Thank You,
David Nowak.
6 Answers, 1 is accepted

Create a label on the form having no text so that it is invisible. In the code-behind set the text property of the label to the following string to execute a function that will cause the form to close:
InjectScript.Text =
"<script>CloseFormFromServer()</" + "script>";
Ensure that a function exists having the same name as that injected into the label, and Voila we have server-side code executing with a javascript function occurring on demand!

I don't know how exactly you ajaxify your code, but I would suggest to make sure that the script in the function is executed - for example you can replace the code with a simple alert.
Please note that this issue is not directly related to the RadWindow control, but it is a general task - e.g. to execute a Javascript function called from the server. Depending on your setup, there are different approaches. For example you can check the following KB article that shows how to call radalert() from the server - I believe the code samples there will be of help:
http://www.telerik.com/support/kb/article/b454K-gtd-b454T-cec-b454c-cec.aspx
Regards,
Georgi Tunev
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center

I'm doing this within a radAjaxPanel and it won't close...
function GetRadWindow() {
var oWindow = null;
if (window.radWindow)
oWindow = window.RadWindow;
//Will work in Moz in all cases, including clasic dialog
else if (window.frameElement.radWindow)
oWindow = window.frameElement.radWindow;
//IE (and Moz as well)
return oWindow;
}
function CloseWindow() {
GetRadWindow().Close();
}
I use the following label: <asp:Literal ID="litCloseWindow" runat="server" />
Here is the text I give it: litCloseWindow.Text = "<script language='javascript'>alert('test');CloseWindow();</" + "script>"
I see that the Javascript is outputting but the client never executes it....

I tried the scenario and its working fine on my end. Can you try alternate option for calling client side function from code behind and see whether its working as expected.
CS:
protected void Button3_Click(object sender, EventArgs e) |
{ |
Page.ClientScript.RegisterStartupScript(GetType(), "key", "<script type='text/javascript'>CloseWindow();</script>", false); |
} |
If you are using the classic ASP.NET version of RadControls, then please make sure that you set the EnableOutsideScripts property of RadAjaxPanel to True, and try the code snippet given above for clossing the window.
Thanks,
Shinu.

you are great , I was in trouble with this problem but you save my day .
Thanks
Debal