简体   繁体   中英

VS2012 cannot access MasterPage Controls from MasterPage Code

I have upgraded my asp.net to VS2012 and converted to web app. The problem is that all my controls from the masterpage now cannot be accessed from the masterpage code !

I have in MasterPage.cs: linkReports.Text="My Link";

and I get this error: error CS0103: The name 'linkReports' does not exist in the current context

It worked before I have upgraded to VS2012

See here: @ Page

CodeFile is for Website Projects whereas CodeBehind is for Web Application Projects.

Change CodeFile to CodeBehind and make sure the inherits path is correct. Whether or not this solves your problem with the user controls, you need to do this for a WAP.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM