ASP.NET custom control: Element is not a known element. This can occur if there is a compilation error in the Web site

Hi Experts,
I'm developing a custom control called MyDateTimeControl. When I register the control to an aspx file in VS2005 like this:
        <%@ Register TagPrefix="UC" TagName="MyDateTimeControl" Src="~/UserControls/MyDateTimeControl.ascx" %>
The tag "~/UserControls/MyDateTimeControl.ascx"  is underlined in red and the IDE says that "File '~/UserControls/MyDateTimeControl.ascx' was not found".

In addition, when I declare an instance of the control:
        <UC:MyDateTimeControl runat="server" id="dtcFrom" ></UC:MyDateTimeControl >
I get this error: "Element MyDateTimeControl is not a known element. This can occur if there is a compilation error in the Web site"

However, I can compile the project and it runs very well. The problem is I cannot use intellisence and the designer.cs file is not regenerated automatically whenever a new control is added anymore.

Could any one show me how to eliminate this annoying problem?
Thank you in advance.
LVL 6
thuannguyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Albert Van HalenAnalyst developerCommented:
I don't know what the reason is/was but I has this behaviour as well.
For me it worked when I didn't specify the ~ at the register directive in the src attribute.

Hopefully it works for you as well...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.