Window Does not Close until a Refresh

4 posts, 1 answers
  1. Vuyiswa
    Vuyiswa avatar
    7 posts
    Member since:
    Jun 2012

    Posted 29 Jun 2012 Link to this post

    Good Day Support 

    I am using a RadWindow to load another page that shows Google map , onClientClose event of the Window i successffully pass the Arguments and that works nice. 

    The issue i have is sometimes the Window does not close it keeps it open.  i Open the Window with this code 

    Copy code
    function GoogleEarthExtended() {
     
        var x = $("#ctl00_ContentPlaceHolder_Main_Wizard1_x").val();
        var y = $("#ctl00_ContentPlaceHolder_Main_Wizard1_y").val();
     
        var url = 'InsertGoogleEarthPhoto.aspx?type=roadmap' '&x= ' + x + '&y= ' + y +'&hfGoogleMapsURLImage=' + document.getElementById("<%=hfGoogleMapsURLImage.ClientID%>").value +'&isHybrid=No';
        var wnd = window.radopen(url);
        wnd.setSize(900, 600);
     
    }

    <asp:Button ID="butGoogleMap" runat="server" CssClass="but_lrg" Height="32px"
                                                            OnClientClick="javascript:GoogleEarthExtended(); return false;"
                                                            Text="Insert Google Earth Map"
                                                            ToolTip="Insert a map of the property by using Google Earth."
                                                            UseSubmitBehavior="False" Width="197px" />

     
    onload of the Popup there is Javascript that has a Popup a user can choose Yes or no depending on the Asnwer it can keep the popup open else close it , so i have provided the javascript that is related to the issue 

    Copy code
    //Check if there is a URL to for the Google map image
          if (getParameterByName('hfGoogleMapsURLImage') != "") {
     
              //if there is ask a User if he wants to use the current Image but of type "RoadMap"
              var desc = confirm('Do you want to insert a roadmap version of the above satellite image?');
          }
          else {
              var desc = false
          }
     
          //if the yes Choose Yes to use the RoadMap
          if (desc == true) {
     
              center = getParameterByName('center');
              zoom = "15";
              maptype = "roadmap";
              x = getParameterByName('x');
              y = getParameterByName('y');
              //set the X and Y for Logic
              document.getElementById("Latitude").value = x;
              document.getElementById("Longitude").value = y;
                
              CloseWithArg();
          }

    so if the variable "Desc" it will assign the textbox that is on the popup with variables and go to the method("CloseWithArg()")that will close the popup with Args as depicted below 

    function CloseWithArg()
           {
     
               var customArg;
               
               if (getParameterByName('isHybrid') == "Yes") {
                 //  alert("inside first If");
                   customArg = document.getElementById("Latitude").value; //0
                  // alert("After x Assignment" + customArg);
                   customArg = customArg + ";" + document.getElementById("Longitude").value;  //1
                   //alert("After y Assignment" + customArg);
                   customArg = customArg + ";" + map.getCenter(); // 2
                   //alert("After NA Assignment" + customArg);
                   customArg = customArg + ";" + zoom; //3
                   //alert("After ZOOM Assignment" + customArg);
                   customArg = customArg + ";" "hybrid"//4 
                   //alert("After MAPTYPE Assignment" + customArg);
                   customArg = customArg + ";" + getParameterByName('isHybrid'); //5
                   //alert("After IShybrid Assignment" + customArg);
     
     
                   GetRadWindow().close(customArg);
                 }
                 else {
                     //alert("Entered else");
                     //alert("X: " + document.getElementById("Latitude").value);
                     //alert("Y: " + document.getElementById("Longitude").value);
                     //alert("center: " + getParameterByName("center"));
                     //alert("zoom: " + getParameterByName("zoom"));
     
                     customArg = document.getElementById("Latitude").value; //0
     
                     customArg = customArg + ";" + document.getElementById("Longitude").value; //1
                     customArg = customArg + ";" + getParameterByName("center"); // 2
                     customArg = customArg + ";" + getParameterByName('zoom'); //3
                     customArg = customArg + ";" "roadmap"//4 
                     customArg = customArg + ";" "No"//5
                       
                     GetRadWindow().close(customArg);
     
                     this.Close();
                 
           }

    function GetRadWindow() {
        var oWindow = null;
        if (window.radWindow) oWindow = window.radWindow;
        else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
        return oWindow;
    }
      
    function Close() {
        GetRadWindow().close();
    }


    So if the "Desc" is "true this will go to the else of this code. as you can see at the end i close it 

    GetRadWindow().close(customArg);


    and even emphesize closing it but it works sometimes, what is it that i am doing wrong? 

    Checked the F12 Error  Chrome debugger  there is no Error.


    Thanks 
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    5709 posts

    Posted 02 Jul 2012 Link to this post

    Hello Vuyiswa,

    We are already working on this in the support ticket you have submitted and I can suggest that we continue the discussion there because a sample can be sent in the ticket so we can get to the bottom of this quickly. Once we reach a conclusion you could post the results of the discussion in this thread as well so that other people with a similar problem can benefit from your experience.

    Kind regards,
    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.
  3. Vuyiswa
    Vuyiswa avatar
    7 posts
    Member since:
    Jun 2012

    Posted 03 Jul 2012 Link to this post

    hi Marin 

    i have sent the Sample Project

    Thanks
  4. Answer
    Marin Bratanov
    Admin
    Marin Bratanov avatar
    5709 posts

    Posted 04 Jul 2012 Link to this post

    Hello,

    I am just writing to follow up with the result of the discussion. The problem originated from body.onload handlers that execute the business logic and the fact that the RadWindow had animations turned on. Animations require time and redraw the popup, so they change the order in which some of the events are fired and if you close the RadWindow before they are finished its popup will become visible in the end again. The solution to this particular case was to remove the animations.


    Kind regards,
    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