从网站转换为 Web 应用程序项目后出现编译错误
我正在尝试将网站转换为 Web 应用程序项目模型,但遇到了编译错误,我在 将网站项目转换为 Web 应用程序项目。
问题在于,作为子控件嵌入到 Ajax 控件工具包的 TabContainer/TabPanel 的 ContentTemplate 中的标准 ASP.NET 控件对于页面不再可见(并导致编译错误)。 看起来它们只能通过调用 FindControl 来引用,而当项目是网站时,它们可以作为属性在页面的代码隐藏文件中直接访问。
不幸的是,我们有很多使用 TabContainer 的 Web 表单,将对子控件的所有引用从简单的属性引用转换为 FindControl 调用将是相当繁重的。
在研究这个问题时,我在 单实例模板 中发现了对名为 TemplateInstance 的属性的引用,这似乎很有希望,但我知道这适用于控件设计者,而不是控件用户。 任何帮助将非常感激。
I'm trying to convert a Web Site to the Web Application project model and I'm running into compile errors that do not seem to be covered by the guidance I found at Converting a Web Site Project to a Web Application Project.
The issue is that standard ASP.NET controls that are embedded as child controls within the ContentTemplate of the Ajax Control Toolkit's TabContainer/TabPanel are no longer visible to the page (and result in compile errors). It appears that they can only be referenced with a call to FindControl whereas, when the project was a Web Site, they were directly accessible in the page's code behind file as properties.
Unfortunately, we have a lot of webforms that utilize the TabContainer, and converting all the references to child controls from simple property refences to FindControl calls will be quite burdensome.
While researching the problem I found a reference to a property called TemplateInstance in Single Instance Templates that seemed promising, but I understand that this is applicable to control designers, not control users. Any help would be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我想我还要补充一点。 该问题并非 Ajax Control Toolkit 的 TabContainer 所特有。 事实上,我有一个 FormView 控件,并且 ItemTemplate 中的所有子控件不再被编译器识别为 Page 的属性,并导致编译错误。 我不敢相信仅仅因为我从网站转移到 Web 应用程序项目,我就必须将所有这些属性引用更改为整个表单中的 findcontrol 调用。 :-(
I thought I'd add one other point. The problem is not specific to the Ajax Control Toolkit's TabContainer. Indeed, I have a FormView control, and all the child controls in the ItemTemplate are no longer recognized by the compiler as being properies of the Page and result in compile errors. I can't believe that I have to change all of these propery references to findcontrol calls throughout my forms just because I moved from a Web Site to a Web Application Project. :-(
我很想知道您最终决定如何解决这个问题。
阅读您的文章,与我自己当前的网络应用程序转换研究相比,让我冒险并向您推荐 此页面希望它可以帮助您了解转换和编译时代码隐藏文件发生的情况。
I'd be curious to hear what your final decision was to resolve this.
Reading your post, compared with my own current web app conversion research, leads me to venture out and refer you to this page hoping it may shed some light on what happens with your code-behind file upon conversion and compilation.
您是否通过“转换为 Web 应用程序...”为所有控件生成了设计器文件?
Did you generate a designer file for all the controls, via "Convert to Web Application..."