简体   繁体   English

ASP.NET:动态添加Webpanel时,获取'currentStyle'为null或不是对象

[英]ASP.NET : getting 'currentStyle' is null or not an object when adding webpanel dynamicly

I added dynamicly infragistics webpanel in my codebehind using : placeHolder.Controls.Add(ctlWebpanel); 我使用以下代码在代码中添加了动态基础设施webpanel:placeHolder.Controls.Add(ctlWebpanel); but i got this javascript error in my ASP.net page in runtime : 'currentStyle' is null or not an object 但是我在运行时的ASP.net页面中遇到了这个JavaScript错误:“ currentStyle”为null或不是对象

How to set the style to remove that error ? 如何设置样式以消除该错误?

Thanks Brian for your concern. 感谢Brian的关心。 I find out that what was missing is css style class. 我发现缺少的是CSS样式类。 I just setted the property cssClass dynamicly when creating my control and it works ! 我刚刚在创建控件时动态设置了属性cssClass,它可以正常工作! But what I still don't understand is why It's mandatory to set it dynamicly when you don't have to if you added it directly in design. 但是我仍然不明白为什么,如果不必在设计中直接添加它,则必须动态设置它。

Well it depends. 这要看情况。 currentStyle is a variable or property that's being called, but there is no underlying reference. currentStyle是一个正在被调用的变量或属性,但是没有基础引用。 It could be with adding it dynamically (at what point do you do this), but probably not. 可以通过动态添加来实现(您在什么时候执行此操作),但可能不会。

Do you see a $create javascript statement for the control in the source? 您在源代码中看到该控件的$ create javascript语句了吗? What line do you get this error, and what is going on in the page? 您会在哪一行收到此错误,页面中正在发生什么?

Can you give any more details? 您能否提供更多详细信息?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM