Search  
Friday, November 21, 2008 ..:: home<page> ::.. Register  Login
 About the error: The name ... does not exist in the current context Minimize
Location: BlogsonDevelopment+=1;    
Posted by: Javier Callico 7/3/2008

When you try to compile in .Net 2.0 (and up) web pages created using .NET 1.1 and automatically migrated by Visual Studio you may receive an error like this:
The name "SampleControl" does not exist in the current context.

If you try to declare the control in your code-behind file you will receive the following error:
The type "SamplePage" already contains a definition for "SampleControl".

The solution is very simple - but hard to find - and involves making the Page class partial and moving all control declarations to a .designer file.

This can be done automatically with the following steps:

1- Right click on the .aspx file for the codebehind file that doesn't compile.
2- Choose the 'Convert to Web Application' option.

This will create a .designer file, and the page will compile.

Permalink |  Trackback

Your name:
Title:
Comment:
Add Comment   Cancel 
  

 Contact Information Minimize
By e-mail:
info at callicode.com

By phone:
416 857 5750

View Javier Callico's profile on LinkedIn
    

 Blog Directories Minimize
    

Copyright 2006 by My Website   Terms Of Use  Privacy Statement
DotNetNuke® is copyright 2002-2008 by Perpetual Motion Interactive Systems Inc.