1

I'm wondering all the possible reasons i might get a errors like:

'MasterPage' does not contain a definition for ...

or

The name '...' does not exist in the current context

I know that these errors are NOT code related. This is a new project that i just pulled from source control. My colleagues are running perfectly fine with this same code which leads me to believe the issue is locally with my dev environment. I thought it might be a file permission issue and so i reset the file permissions on the entire solution which did not resolve the issue.

What am i missing? Why are my ASPX pages throwing these errors at me?

Any ideas on where to look next to resolve this would be awesome.

TIA

UPDATE:

I managed to resolve all the errors i was seeing by actually running the solution (despite the Visual Studio errors i was getting). Once i stopped and came out of debug mode, the errors were gone in Visual Studio.

I would very much like to know what is happening with VS that after running the solution the errors resolve?!?! Is VS creating some sort of reference behind the scenes?

Very confused....

Nugs
  • 5,503
  • 7
  • 36
  • 57
  • check this http://stackoverflow.com/questions/706603/the-name-controlname-does-not-exist-in-the-current-context] – Abdul Ghaffar Mar 01 '17 at 16:30
  • That's not my issue, everything is matching and like i said this code is working in other environments, so it can't be code related, nor do i want to modify working code. – Nugs Mar 01 '17 at 16:59
  • I resolved the initial error and updated my question above... – Nugs Mar 01 '17 at 17:17
  • Sometimes VS gets a little confused. Restarting it will help most of the time (unless the error are actually genuine of course). – VDWWD Mar 01 '17 at 18:00

1 Answers1

0

Check the code behind file. If you aspx page has something like this:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="AdminMaster.master.cs" Inherits="admin_AdminMaster" %> 

(admin being the sub-folder name), then code behind should look like:

public partial class admin_AdminMaster : System.Web.UI.MasterPage
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135