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

2 question about opening the radwindow in the server side

1 Answer 58 Views
Window
This is a migrated thread and some comments may be shown as answers.
songsp
Top achievements
Rank 1
songsp asked on 02 Mar 2010, 03:06 AM

hello, telerik
en,About the question 2, I met 2questions.
1. In the server-side code,How do  I open the radwindow?
2. For the window opened ,I have a  "<asp:button runat='server'>,How do  I close the current window when I clicking the button at server side after I executed persisting operation(such as update a row in the table)?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 02 Mar 2010, 05:28 AM
Hello,

1.
You can use the following code in order to open the window from server side.

C#:
 
    protected void Button1_Click(object sender, EventArgs e) 
    { 
        RadWindow newwindow = new RadWindow(); 
        newwindow.ID = "RadWindow2"
        newwindow.NavigateUrl = "http://www.google.com"
        newwindow.VisibleTitlebar = true
        newwindow.Behaviors = WindowBehaviors.Close; 
        newwindow.VisibleOnPageLoad = true
        RadWindowManager1.Windows.Add(newwindow); 
    } 
Checkout the documentation to know more about this topic.

2.
I guess you have placed the button in the content page (page opened in radwindow), if so you can try the code below to close the window.

C#:
 
ScriptManager.RegisterStartupScript(thisthis.GetType(), "closeWindow""CloseOnReload();"true); 

JavaScript:
 
    <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 CloseOnReload() { 
            GetRadWindow().close(); 
        } 
    </script> 
The above example uses a javascript function for closing the window which is called from server. Refer the blog for more information about executing javascript from server.
Executing JavaScript function from server-side code 


Regards,
Shinu.
Tags
Window
Asked by
songsp
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or