Last post Feb 23, 2009 02:15 PM by DonL
Feb 23, 2009 10:41 AM|DonL|LINK
I built a few user controls as part of one application that need to be used in a few others, so I created a new web application and moved them into it, with the thought that this project could be loaded into the solutions for other apps and shared that
way. I also added namespaces on the code-behind files and updated the "Inherits" attribute at the top of the .ascx files to reflect the new namespace (e.g. Inherits="myToolkit.myControl").
When I look at the code-behind for the controls, there are no errors underlined, and intellisense will pop up the names of the components inside the ASCX, but when I try to build the project, I get a long list of "Name 'whatever' is not declared" errors
and complaints about Handles clauses for nonexistant controls. Is there some reason why the link between the ascx and ascx.vb would be unrecognized at build time?
This is in VS2008, .net 3.5, in a web application project. Controls are in either the root of the project or a custom named subdirectory, code-behinds all set to build action=compile.
Feb 23, 2009 02:15 PM|DonL|LINK
I tried declared the controls on the .ascx in code, e.g.
protected withevents tb1 as textbox
- but it complained that tb1 already existed (which is correct, but I couldn't get .net to believe this at compile time).
I've gotten around the problem by creating new, empty controls, pasting the existing control markup & code into the new files, and compiling - works fine, but is a pain to have to do. I'd still like to have some idea what would have been causing this problem
and whether there's a better way around it.