window will not close even after calling Window.close()

6 posts, 0 answers
  1. digish devassy
    digish devassy avatar
    18 posts
    Member since:
    Mar 2010

    Posted 16 Jul 2012 Link to this post

    pop up window which will not close. The only way to close the RadWindow is window.Close () from client side which is not working in this case. 

    function GetRadWindow() {

     

     

     

    var oWindow = null;

     

     

     

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

     

     

     

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

     

     

     

    return oWindow;

     

    }

     

     

     

    function CloseWin() {

     

     

     

    //Get the RadWindow

     

     

     

    var oWindow = GetRadWindow();

     

     

     

    //Call its Close() method

     

     

     

    if (oWindow) {

     

    oWindow.Close();

     

     

    // alert(oWindow.isClosed())

     

    }

     

     

    //GetRadWindow().close();

     

     

     

    // return false;

     

     

     

    //oWindow.close();

     

    }

    nothing works.

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 16 Jul 2012 Link to this post

    Hi,

    Unfortunately I couldn't replicate the problem. Here is the code I tried based on your scenario which works as expected at my end.

    ASPX:
    <telerik:RadWindow runat="server" ID="RadWindow1" Title="window1" VisibleOnPageLoad="true" NavigateUrl="SecondWindow.aspx" >
    </telerik:RadWindow>

    SecondWindow.aspx

    ASPX:
    <asp:Button ID="Button1" runat="server" OnClientClick="return 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();
      if (oWindow)
      {
       oWindow.Close();
      }
     }
    </script>

    Thanks,
    Princy.
  3. digish devassy
    digish devassy avatar
    18 posts
    Member since:
    Mar 2010

    Posted 17 Jul 2012 Link to this post

    the code you showed me works for all other pages I have used radwindow. in this page. I have no idea, window just wont close. I am looking for something like one big time javascript window killer. You give that command and the window will be gone.
  4. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 19 Jul 2012 Link to this post

    Hi Digish,

    I can make a few assumptions on what could be causing the problem you describe but i need some more information in order to determine which of my assumptions is most likely to be true.

     Can you please provide the following information:

    1) Do you use radWindow with ContentTemplate or with NavigateUrl? If you are using ContentTemplate, your code is invalid for this case.

    2) From where you want to close the RadWindow - from the parent page where you opened it or from the content page which is inside of radWindow with NavigateUrl? Your code is valid only in case called from content page.

    3) Please, make sure you have no js errors on the page. A js error causes unexpected results and your code might not be executed due to that even if it is valid for your scenario.

    In case the above notes still do not help you resolve the issue, once we receive the requested information, we will suggest on how to proceed.

    Regards,
    Svetlina Anati
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  5. digish devassy
    digish devassy avatar
    18 posts
    Member since:
    Mar 2010

    Posted 19 Jul 2012 Link to this post

    1. I am using Navigational URL. I tried the content template, but could not find the function to close the content template one.
    2. I am trying to close it from the content page.
    3. I am not very sure on Javascript error. I do not remember any other javascript than the one for closeing the radwindow in the content page. But in the parent page. I am not that sure. I will check.

    Thanks.

  6. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5709 posts

    Posted 23 Jul 2012 Link to this post

    Hi Digish,

    When working with content pages the beforementioned GetRadWindow() function is necessary to get a reference to the RadWIndow object in order to call the close() method from its own client-side API. There is a major difference between the window.close() method and the close() method of the RadWindow, as the latter is a script control and not a browser window.

    I also advise that you examine the ContentTemplate vs. NavigateUrl Online Demo in order to better see the difference between the two modes and how to work with them.


    All the best,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top