ASP.NET:获取“currentStyle”动态添加 webpanel 时为 null 或不是对象
我使用以下方法在代码隐藏中添加了动态 infragistics webpanel: placeHolder.Controls.Add(ctlWebpanel); 但我在运行时的 ASP.net 页面中遇到了以下 javascript 错误: “currentStyle”为 null 或不是对象
如何设置样式以消除该错误?
I added dynamicly infragistics webpanel in my codebehind using :
placeHolder.Controls.Add(ctlWebpanel);
but i got this javascript error in my ASP.net page in runtime :
'currentStyle' is null or not an object
How to set the style to remove that error ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
感谢布莱恩的关心。我发现缺少的是 css 样式类。我刚刚在创建控件时动态设置了属性 cssClass 并且它有效!
但我还是不明白的是,如果直接在设计中添加就不需要动态设置,为什么还要强制动态设置。
Thanks Brian for your concern. I find out that what was missing is css style class. I just setted the property cssClass dynamicly when creating my control and it works !
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.
好吧,这取决于。 currentStyle 是正在调用的变量或属性,但没有基础引用。可能是动态添加它(在什么时候执行此操作),但可能不是。
您是否在源代码中看到了控件的 $create javascript 语句?您在哪一行收到此错误?页面中发生了什么?
你能提供更多细节吗?
Well it depends. currentStyle is a variable or property that's being called, but there is no underlying reference. 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? What line do you get this error, and what is going on in the page?
Can you give any more details?