Important item to note about ASP.NET 2.0 - Reference Compiler Directive

Posted Friday, July 15, 2005 8:48 AM by C-Dog's .NET Tip of the Day
If there is any tip of the day to actually read, it is certainly this one.  This is the one to pay attention to, otherwise you will be pulling your hair out trying to figure out why IntelliSense is not finding a particular control. 
 
A new compiler directive has been added called reference.  It takes a single parameter control which points to the location of a web user control.  If you do not have a reference or register compiler directive in your .aspx or .ascx file to a control, the code-behind will not be able to see that control and it will not compile.  Namespaces are effectively gone.  They don't mean a thing in a web project.  This is necessary even when the control you are referencing is in the same directory.
 
This by far is the single lamest thing they have done to ASP.NET 2.0.  Here is what the syntax looks like.
<%@ Reference control="~/Reservations/Controls/LocationTime.ascx" %>
Note the use of the tilda.  Remember a tilda in a path means go back to the root of that web application.  It is always required for any control reference or register tag (starting a path with a slash simply does not work).

Read the complete post at http://www.dotnettipoftheday.com/blog.aspx?id=93