调用堆栈只包含外部code [英] The call stack contains only external code

查看:1678
本文介绍了调用堆栈只包含外部code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想,当我点击一个其他显形。我是这样做使用jQuery,但我不强了。我写的脚本:

I want that when I click on a other became visible. I'm do it using jQuery, but I'm not strong in it. I wrote script:

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

我已经经历了С#做的布局:

The layout I have done through С#:

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

当然,它没有工作。不过,也有得到一个错误:

Of course, it didn't work. But also a get an error:

没有剧本,一切都很好。 我试图禁用只是我的code和得到的:

Without script everything is fine. I tried to disable Just My Code and got that:

真的,我用Google搜索该怎么做,但没有成功。你可以帮帮我吗?

Realy, I googled what to do, but without success. Could you help me?

P.S。在jsfiddle.net我在工作的脚本。       http://jsfiddle.net/ZMxg8/

P.S. On jsfiddle.net my script in working. http://jsfiddle.net/ZMxg8/

P.P.S:这个问题是不是在脚本!什么跟VS发生?什么意思是调用堆栈只包含外部code???

P.P.S: The problem isn't in script! What happened with VS?? What means "The call stack contains only external code"???

推荐答案

您code动态生成面板,但不包括它们的控制树

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

更新您的code是这样的:

Update your code like this:

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

不过,我建议你在ASPX标记声明本小组。这将是更容易维护。

However, I suggest you to declare this Panels in the aspx markup. This will be easier to maintain.

这篇关于调用堆栈只包含外部code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆