0

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 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.

P.S. :- 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)'

Appreciate your help and Thanks in advance

Rohit
  • 1
  • 2
  • You didn't mention any specific errors or problems? What goes wrong? But one obvious thing to note is that JS is case-sensitive. `Config` != `config` . Correct that any you may have better luck. – ADyson Sep 24 '20 at 14:58
  • Apart from that, it looks like it should work as long as the JS file is included in the aspx file (preferably after the script block which includes the definition of the Config function). Or just put them both into the JS file...there seems no obvious reason not to do so. If you continue to have issues though, please check your browser's Console for errors. – ADyson Sep 24 '20 at 14:59
  • @ADyson: thanks for your comment. As your suggestion I edited my Q again and i did as you suggest to put js file reference in aspx page and even put master page also but still it not work and it show the error in console is 'config.js:7 Uncaught ReferenceError: Config is not defined at config (VM84 config.js:7)'. Kindly suggest. Thanks – Rohit Sep 25 '20 at 07:35
  • Did you try putting both functions inside the JS file? There seems no reason for them to be separate. – ADyson Sep 25 '20 at 09:01
  • @ADyson:- That I can't do that to put both function inside of js file because 'function Config(testID, UnitID)' used telerik property i.e. "ConfigRadWindow" to call another aspx page. – Rohit Sep 25 '20 at 09:32
  • It shouldn't matter. If the JS file is then included into the page, it will still know about that. – ADyson Sep 25 '20 at 09:35
  • @ADyson:- when i do that it give me 'Uncaught ReferenceError: radopen is not defined' error massage on console. Is am i missing some reference of this function ? please give some idea on that. – Rohit Sep 28 '20 at 09:04
  • As long as you include your .js file in the page _after_ the `RadWindowManager` control then I doubt there should be a problem. When you're loading things into a HTML document, the order you load them in is important. – ADyson Sep 28 '20 at 09:08
  • @ADyson:- I will give the order of load. Here is Main.aspx page which load first and in the middle of page I defined – Rohit Sep 28 '20 at 12:30
  • That's the first time you've mentioned using an iframe. It's an important detail. You can't just call a function in the parent page directly from the child page. See https://stackoverflow.com/questions/2161388/calling-a-parent-window-function-from-an-iframe – ADyson Sep 28 '20 at 12:33
  • 1
    @ADyson:- well i mention about iframe in my Q 2nd line, but anyway you give me right direction to how call my function. That given link help me a lot. Thank you very much your time and valuable solution. – Rohit Sep 28 '20 at 13:52
  • Oh sorry I totally missed that. Apologies. You're right to edit and make it bold! – ADyson Sep 28 '20 at 13:54

0 Answers0