This is a migrated thread and some comments may be shown as answers.

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

3 Answers 1816 Views
Window
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 14 Apr 2014, 01:13 AM

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>

3 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 14 Apr 2014, 02:15 AM
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
0
Jamie
Top achievements
Rank 1
answered on 26 Apr 2017, 04:16 AM
Hi John.... taking as long shot that you still visit this page and will see this. I have a question about your problem/solution here to see if it applies to what I am attempting to do. lmk if you see this. Thank you.
0
John
Top achievements
Rank 1
answered on 27 Apr 2017, 02:44 AM

I guess a long shots is better than no shot.

What's on your mind?

Tags
Window
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Jamie
Top achievements
Rank 1
Share this question
or