开发者

Do controls need to be defined in a web app or will .NET do it for you

I always thought that when you dropped a control onto an .aspx page that a declaration of that control ended up being generated for you (either in a designer file, or within your code behind). All of the apps I have worked on have worked this way.

A coworker of mine was installing resharper and it was showing that all her code behind pages would not build. Turned out that resharper could not find a definition for any control that she has dropped onto her markup. She has no designer files, and no declarations in markup. Do they get automatically built when putting together the partial classes? Is there an option at that page/project level to instruct .NET to do this for you? Is this a difference between web app and web site?

Thi开发者_如何转开发s is a a .NET 3.5 site, C#, and it is running in a production environment.

Thanks in advance


You are correct in the difference is that she's running a Web Site project as opposed to a Web Application project. In a website there are no designer files. So to answer each of your questions...

Do they get automatically built when putting together the partial classes?

  • Yes, when the .aspx gets compiled the controls are created as if they were there...this happens in the background in VS so you get intellisense.

Is there an option at that page/project level to instruct .NET to do this for you?

  • Kinda, use a Web Application project for this :)

Is this a difference between web app and web site?

  • Yes, one of the main differences :) Web Application projects have a Page.aspx.designer.cs that house the control declarations.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜