Window Close

4 posts, 0 answers
  1. phil doc
    phil doc avatar
    9 posts
    Member since:
    Jun 2009

    Posted 23 Oct 2009 Link to this post

    Hi,

    Incredibly stupid question here but how do i get the window to close when I click a button within it instead of clicking the red x at the top right.

    I was looking for a me.close() or something equivalent.

    Thks,

    Phil
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 Oct 2009 Link to this post

    Hi Phil,

    Try the following client side code in order to close RadWindow when clicking button inside window page.

    aspx:
     
    <input id="Button2" type="button" value="button" onclick="closeWin()" /> 

    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 closeWin() 
       var oWindow = GetRadWindow(); 
       oWindow.close(); 
    }   
    </script> 

    -Shinu.
  3. phil doc
    phil doc avatar
    9 posts
    Member since:
    Jun 2009

    Posted 23 Oct 2009 Link to this post

    And how would i get that javascript method to fire after I've ran some server side code behind the button?

    Thanks for the help,

    Phil
  4. Luis
    Luis avatar
    23 posts
    Member since:
    Mar 2009

    Posted 28 Oct 2009 Link to this post

    create the javascript as always on the source code then after you run your code behind do this:

    ScriptManager.RegisterStartupScript(Me, Me.GetType, "Javascript", "javascript:closeWin();", True)


    thanks
Back to Top