The call stack contains only external code

I want it to be visible when I click on another. I do this using jQuery, but I'm not sure about that. I wrote a script:

<script type="text/javascript"> $(document).ready(function () { $('.visiblePanel').on('click', function () { $('.invisiblePanel').toggle(); }); }); </script> 

The layout I made through C #:

 Panel visiblePanel = new Panel(); visiblePanel.Style.Add("background-color", "red"); visiblePanel.CssClass = "visiblePanel"; Panel invisiblePanel = new Panel(); invisiblePanel.CssClass = "invisiblePanel"; 

Of course, this did not work. But also get the error: enter image description here

Without a script, everything is fine. I tried disabling Just My Code and got the following:

enter image description here Really, I googled what to do, but to no avail. Could you help me?

PS On jsfiddle.net my script is working. http://jsfiddle.net/ZMxg8/

PPS: the problem is not in the script! What happened to VS? What does "call stack contain only external code" mean ???

+4
source share
3 answers

Your code dynamically generates Panel , but does not include them in the Control Tree.

Update your code as follows:

 Panel visiblePanel = new Panel(); visiblePanel.Style.Add("background-color", "red"); visiblePanel.CssClass = "visiblePanel"; this.Controls.Add(visiblePanel); Panel invisiblePanel = new Panel(); invisiblePanel.CssClass = "invisiblePanel"; this.Controls.Add(visiblePanel); 

This should solve the problem.

However, I suggest you declare these panels in aspx markup. It will be easier to maintain.

+2
source

Try this code:

  $(document).ready(function () { $('.visiblePanel').click(function () { $('.invisiblePanel').toggle(); }); }); 

C # code

  Panel visiblePanel = new Panel(); visiblePanel.Style.Add("background-color", "red"); visiblePanel.CssClass = "visiblePanel"; visiblePanel.Width = 10; visiblePanel.Height = 10; this.Controls.Add(visiblePanel); Panel invisiblePanel = new Panel(); invisiblePanel.Width = 10; invisiblePanel.Height = 10; invisiblePanel.CssClass = "invisiblePanel"; invisiblePanel.Style.Add("background-color", "black"); this.Controls.Add(invisiblePanel); 
0
source

I have found a solution. Steve B was right. The error "Call stack contains only external code" informed me that the debugger cannot debug JavaScript code. And "mscorlib.pdb not loaded", because when I tried to fix the first error, I disabled something in the settings. =) Thank you all for your help.

0
source

Source: https://habr.com/ru/post/1493183/


All Articles