I am posting this after encountering and eventually resolving this VS.NET 2005 build error. Some other threads here mention this build error in a more general context, but because this one was triggered specifically by a javascript line in an ASP.NET 2.0 control, I am starting a separate thread.

Issue:
The following control resides in an ASP.NET 2.0 aspx, but triggers build error "The name does not exist in the current context.":

<asp:TextBox ID="txtSomeDate" runat="server" Text Width="100px" /><a href="javascript:var cid = '<%# txtSomeDate.ClientID %>'; show_calendar(cid);"><img width="16" height="16" src="_res/img/cal.gif" alt="Click Here to select date" /></a>

Cause and Resolution:
The reference to txtSomeDate in the javascript above was ...

Go to the complete details ...