Trying to refresh-reload child IFrame content from parent page.

2 posts, 0 answers
  1. John
    John avatar
    3 posts
    Member since:
    Aug 2013

    Posted 13 Apr 2014 Link to this post


    PARENT PAGE
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
     <Windows>
      <telerik:RadWindow ID="ServerAdd" runat="server" Behavior="Close" Behaviors="Close" Modal="True" NavigateUrl="ServerAssignJob.aspx" style="display:none;" VisibleStatusbar="False" DestroyOnClose="True" OnClientClose="windowOnClientClose" MinHeight="600px" MinWidth="850px">
      </telerik:RadWindow>               
     </Windows>
    </telerik:RadWindowManager>
    <script type="text/javascript">
     function windowOnClientClose(sender, args) {  
      for (var i = 0; i < self.frames.length; i++) {
       
       var myFrame = self.frames[i].document.getElementById("RadPageViewServers");   

    if (myFrame != undefined || myFrame != null) {
        //THIS DOESN'T WORK
        //myFrame.contentDocument.location.href = "ServerAssign.aspx";    
    //myFrame does get the reference to the correct IFrame I can see the innerhtml and it looks correct.
        //THIS DOES NOT RELOAD THE PAGE
        myFrame.src = myFrame.src;
        
        
        //THIS DOES NOT WORK
        //JavaScript runtime error: Unable to get property 'location' of undefined or null reference
        //myFrame.contentDocument.location.reload(true);
        break;
       }   
       return false;
      }      }
    </script>


    CHILD IFRAME CONTENT URL = "ServerAssign.aspx"
    It calls the radopen on parent page.

    <script type="text/javascript" >
     function clickHandler(sender, eventArgs) {
     
     //Checks which item is clicked
     if (eventArgs.get_item().get_text() == "Add New") {
      
      var topWindow = window.top;
      var tab = topWindow.document.getElementById('RadWindowManager1');
      
      topWindow.radopen("ServerAssignJob.aspx", "ServerAdd");    
      return false;
     }    }</script>
  2. John
    John avatar
    3 posts
    Member since:
    Aug 2013

    Posted 13 Apr 2014 in reply to John Link to this post

    Ok after looking at my innerHtml I see that I was grabbing a reference to the RadPage Div and not the IFrame element it created.
    So after adding this code it works.
    if (myFrame != undefined || myFrame != null) {
     varRealFrame = myFrame.firstElementChild;                            
     varRealFrame.contentDocument.location.reload(true);
     break;
    }  
    Thanks John
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top