Link to home
Start Free TrialLog in
Avatar of NazoUK
NazoUKFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Visual Studio 2008 Error List showing spurious errors

My Visual Studio (developing asp.net applications) error list constantly shows hundreds of errors, even though there are actually none within the site. The errors are all of exactly the same type: 'The name xxx does not exist in the current context'. xxx refers to a server side control declaratively defined.  It seems like VS is checking the code behind files but isn't checking the declarative files when doing its checks.
The app builds without issue.

It's not killer, but it is annoying and makes it difficult to find genuine errors. I've applied all service packs and updates. Anyone encountered this and know how to fix it?
Avatar of Dirk Haest
Dirk Haest
Flag of Belgium image

Found at another forum:  found out the that problem is cause by the back up copy from the same file (copy of default.aspx) that i forget to exclude from the project. The problem solved after i exclude the file from the project.

http://dotnetfish.blogspot.com/2007/08/name-xxx-does-not-exst-in-current.html
In your code behind you must create the member as well. When you drag/drop a control on you Layout View VS will generate this for you; otherwise you have to do it yourself. It isn't that hard:

 
public class MyWebPage : System.Web.UI.Page
{
     protected System.Web.UI.WebControls.Panel pnlDescription;
     // ...
 
Avatar of NazoUK

ASKER

Hi,

Thanks for the response but I've checked my project and there aren't any backup files in there.
Also, I've never heard of having to declare server controls in the code-behind as well and never seen it done in any of the books, blogs, articles etc I've read so I'm not convinced about that. Also I tested in VS layout view and it didn't automatically add anything.
ASKER CERTIFIED SOLUTION
Avatar of NazoUK
NazoUK
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial