Tuesday, July 29, 2008

Error: The name 'instance-variable' does not exist in the current context

Recently I got the following error "The name 'instance-variable' does not exist in the current context" where 'instance-variable' was the member variable of one of my page.  I was really confused as I was sure that I was doing it right.  So what else could be the problem?  Well it turns out that I had made a backup copy of the file in the same directory before I had changed it.  I turns out that in a Asp.Net 2.0 website you can't have two ASP.NET pages or user controls with the same name class name.  Because the pages are partial classes it does not give the error "The namespace 'global-namespace' already contains a definition for 'instance-variable'" like you would normally get if you redefined a class.  Read more here...