Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I worked in .net application, in this application from one aspx page to call one html page through iframe and called webservice through JS function. in this html file have button and on this click event I want to call popup window in aspx javascript through another js function. here is code

on html page

<div id="dropArea">
       <button type="button" runat="server" onclick="Test()"> clickme </button>

   </div>


JS file function

    function Test() {
    Config('123', '567');   
}


this config function exists in aspx page

aspx page code

<telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Black" Modal="True" ReloadOnShow="True" ShowContentDuringLoad="False" VisibleStatusbar="False" EnableShadow="True" Overlay="True" EnableViewState="False">
	 <Windows>
             <telerik:RadWindow ID="ConfigRadWindow" runat="server" Width="750" Height="500" VisibleOnPageLoad="false" Behaviors="Move,Resize,Close" IconUrl="images/icoPhraseTranslationManager.png" Title="Configure" />
    </Windows>
  </telerik:RadWindowManager>
<script src="javascript/config.js"></script>
<script type="text/javascript">
 function Config(testID, UnitID) {
    var oWnd = radopen("Config.aspx?ID=" + testID + "&UnitID=" + UnitID, "ConfigRadWindow");
  }
</script>


I am able to call aspx page with use window.open function but requirement is that to call this Config()function through js function.



Appreciate your help and Thanks in advance

What I have tried:

I put reference of JS file in aspx page and master page and give me error in console is 'config.js:7 Uncaught ReferenceError: Config is not defined
   at config (VM84 config.js:7)'
Posted
Updated 28-Sep-20 1:24am
Comments
Sandeep Mewara 28-Sep-20 6:54am    
Config() is not defined in the references JS. surely something is missing as a connect.

Check with developer tools to see if the JS and function is there for the page to use.

1 solution

If you're trying to call a Javascript function in a parent page from a page loaded inside an iframe, you need to prefix the function name with parent. to indicate that it's defined in the parent document.
JavaScript
function Test(){
    parent.Config('123', '567');
}
Window.parent - Web APIs | MDN[^]
 
Share this answer
 
Comments
Rohit Dashore 28-Sep-20 9:24am    
@Richard:- Thanks for your suggestion. That small thing i missed in my code and struggle for one day. Appreciate your help.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900