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

Self opening window

1 Answer 122 Views
Window
This is a migrated thread and some comments may be shown as answers.
Konrad
Top achievements
Rank 1
Konrad asked on 22 Feb 2011, 10:49 PM
Hi

I open my window in code behind using VisibleOnPageLoad and AjaxRequest.  I also set a navigation url in this ajax request. When I want to close window I call javascript function on page which was loaded as content of the window. Function look like this:
<script type="text/javascript">
    
    function GetRadWindow() {
        var oWindow = null;
        if (window.radWindow) oWindow = window.radWindow;
        else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
        return oWindow;
    }
 
    function CloseAndRebind() {
        GetRadWindow().BrowserWindow.selectionFinalize();
        GetRadWindow().Close();
        return false;
    }
    
</script>
>

But when window is closed, it opening itself.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Feb 2011, 12:01 PM
Hello,

Since you are setting the VisibleOnPageLoad property to True, the window will be open for every postback. So one suggestion would be opening the window from client code as shown below.

C# code for invoking the client event handler which opens the window:

string script = "<script language='javascript' type='text/javascript'>Sys.Application.add_load(showWindow);</script>"
ClientScript.RegisterStartupScript(this.GetType(), "showWindoww", script);

Javascript
<script type="text/javascript"
       function showWindow()
       
             // Opens the window
       
   </script>

Thanks,
Shinu
Tags
Window
Asked by
Konrad
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or