Asp.net controls are not accessible in code behind

后端 未结 26 1161
慢半拍i
慢半拍i 2020-12-15 16:25

I have a project that was previously built by someone else. When I try to add a new control to the page, I can\'t access it in the code behind. When I try to access it there

26条回答
  •  隐瞒了意图╮
    2020-12-15 17:19

    This happened to me in a website project in VS2010, but as I'm part of a larger team, I don't have the option to convert to Web Application as Domenic suggested.

    It turns out it was because I had switched my default editor for ASPX files to "HTML Editor" instead of "Web Form Editor". I did this because intellisense was killing my computer whenever I opened an ASPX file. When I right clicked on this page to "Open With..." the "Web Form Editor", and added the controls again, it worked perfectly and they're now available in the code behind file.

提交回复
热议问题