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

Close Radwindow From Server Side

1 Answer 177 Views
Window
This is a migrated thread and some comments may be shown as answers.
Raymond
Top achievements
Rank 1
Raymond asked on 25 Mar 2009, 03:38 PM
I have opened a radwindow. Inside this window, there is a proxy manager to refresh the page when save button is click. I wish to close the window when delete button is click once the server code has removed the record from database. However, this does not work.

The Coding on clicking the delete button is as follows 

 

string JS = "<script type=text/javascript>";

 

JS +=

"function GetRadWindow1(){";

 

JS +=

"var oWindow = null;";

 

JS +=

"if (window.radWindow) oWindow = window.radWindow;";

 

JS +=

"else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;";

 

JS +=

"return oWindow;}";

 

JS +=

"var oWindow = GetRadWindow1();";

 

JS +=

"oWindow.Close();";

 

JS +=

"oWindow.BrowserWindow.refreshGrid();";

 

JS +=

"</script>";

 

RegisterStartupScript(

"CloseWindowStartupScript", JS);

I have tried this method and is still not working

 

lblClose.Text=

"<script type='text/javascript'>GetRadWindow().Close();GetRadWindow().BrowserWindow.refreshGrid();</script>";

 

 


BUT When I remove the proxy manager in this window. Everything works. Any resolution to this issue?

1 Answer, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 26 Mar 2009, 03:06 PM
Hello Raymond,

When working with Ajax, you need to use the RegisterStartupScript method of the ScriptManager or ResponceScripts collection of the RadAjaxManager.

More information on the subject (calling JavaScript function in Ajax environment) is available in various resources in the Net. You could also check the following KB that shows how to call radalert() from server - the idea of the approaches described there is the same:
http://www.telerik.com/support/kb/aspnet-ajax/window/calling-radalert-from-codebehind.aspx



Best wishes,
Georgi Tunev
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Window
Asked by
Raymond
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Share this question
or