Element <element> is not a known element warning in Visual Studio when using User controls Element <element> is not a known element warning in Visual Studio when using User controls asp.net asp.net

Element <element> is not a known element warning in Visual Studio when using User controls


This sounds like a classic re-build your solution and "close and re-open Visual Studio" problem.

It's possible it may also be related to a similar problem I had which I answered at Resolving "Validation (): Element ‘xxxx’ is not supported" warning in Visual Studio 2005/2008.


This can also occur if the element you're trying to add is within the tags of another element that it shouldn't be within.

For Example:

<asp:Button ID="button" runat="server" >    <asp:Repeater ID="repeater" runat="server"></asp:Repeater></asp:Button>

Or in my case, placing an <asp:Repeater> in an <asp:UpdatePanel> and forgetting to put it in the <ContentTemplate>:

<asp:UpdatePanel ID="upPanel" runat="server">    <ContentTemplate>        <asp:Repeater ID="rep" runat="server">        </asp:Repeater>    </ContentTemplate></asp:UpdatePanel>


Apparently this can also happen if the Namespace name in the .ascx file doesn't match the namespace in the ascx.cs (codebehind) file. Just one more issue to check.