Asp.net controls are not accessible in code behind

后端 未结 26 1203
慢半拍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:03

    If you're experiencing this issue in VS2013 in a Website (as opposed to a Web Application) and have more than one aspx file sharing a codebehind then you need to make sure that ALL the aspx files have exactly the same collection of controls.

    In previous versions of Visual Studio this wasn't an issue but it looks like VS2013 has tightened up.

    I hope this helps someone - I only spotted it thanks to Sergey's comment above.

提交回复
热议问题