2 question about opening the radwindow in the server side

2 posts, 0 answers
  1. songsp
    songsp avatar
    9 posts
    Member since:
    Feb 2009

    Posted 01 Mar 2010 Link to this post


    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)?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 01 Mar 2010 Link to this post

    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.
Back to Top