title: Using ASPX Web User Control with Visual Studio 2010
body: <p>I am trying to implement a Web User Control into one of my APSX pages but keep getting the following warning:  </p>
  
  <blockquote>
    <p>Element 'IntFilter' is not a known element. This can occur if there is a compilation error in the Web site, or the web.config file is missing.</p>
  </blockquote>
  
  <p>The user control is defined in the same web project as the aspx page.</p>
  
  <p>Question:<br>
  How do I resolve this warning (I do not want to move the control to a separate project)?<br>
  Also, what do I need to do to enable IntelliSense for this control so I can set its FilterTypeSelection property from ASPX?</p>
  
  <p>Code for "~/FilterControls/IntFilter.ascx"</p>
  
  <pre><code>&lt;%@ Control Language="vb" AutoEventWireup="false" CodeBehind="IntFilter.ascx.vb" Inherits="StaffSupport.Filters.IntegerFilter" %&gt;
  &lt;asp:DropDownList ID="typeFilterDropDownList" runat="server"&gt;
      &lt;asp:ListItem Selected="True"  Text ="Any"          Value="-1" /&gt;
      &lt;asp:ListItem Selected="False" Text ="Equal"        Value= "0" /&gt;
  &lt;/asp:DropDownList&gt;&lt;br /&gt;
  &lt;asp:TextBox ID="TextBox1" runat="server" /&gt;&lt;asp:CheckBox ID="CheckBox1" runat="server" Text="Inclusive" /&gt;&lt;br /&gt;
  &lt;asp:TextBox ID="TextBox2" runat="server" /&gt;&lt;asp:CheckBox ID="CheckBox2" runat="server" Text="Inclusive" /&gt;&lt;br /&gt;
  </code></pre>
  
  <p>Code for "~/FilterControls/IntFilter.ascx.vb" </p>
  
  <pre><code>Namespace Filters
      Public Class IntegerFilter
          Inherits System.Web.UI.UserControl
  
          Public Enum NumberFilterTypes As SByte
              Any = -1
              Equals = 0
          End Enum
  
          Public Property FilterTypeSelection As NumberFilterTypes
              Get
                  Dim value As SByte
                  If Not  Integer.TryParse(typeFilterDropDownList.SelectedValue, value) Then
                      value = -1
                  End If
  
                  Return CType(value, NumberFilterTypes)
              End Get
              Set(value As NumberFilterTypes)
                  typeFilterDropDownList.SelectedValue = CSByte(value)
              End Set
          End Property
  
          Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  
          End Sub
  
      End Class
  End Namespace
  </code></pre>
  
  <p>Code for "OpenCases.aspx"</p>
  
  <pre><code>&lt;%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/StaffSite.Master" CodeBehind="OpenCases.aspx.vb" Inherits="StaffSupport.OpenCases" %&gt;
  &lt;%@ Register TagPrefix="filters" TagName="IntFilter" src="~/FilterControls/IntFilter.ascx" %&gt;
  &lt;asp:Content ID="bodyContent" ContentPlaceHolderID="cphBody" runat="server"&gt;
      ID&lt;br /&gt;
      &lt;filters:IntFilter ID="IntFilter1" runat="server" /&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p>Code for "OpenCases.aspx.vb"</p>
  
  <pre><code>    Public Class OpenCases
          Inherits System.Web.UI.Page
      Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
          Page.ViewStateMode = UI.ViewStateMode.Disabled
      End Sub
  </code></pre>
  
  <p><strong>Update 2012/02/21:</strong><br>
  Fixed the "filters" vs "filter" miss match.</p>
  
  <p>Also of note, if you drag the control from the Solution Explorer to the page in Design view it will add the references you need (though it was still generating the warning for me).  If you drag it to the page in source view it will add an a tag with a href to the element.</p>
  
  <p><strong>Update 2012/02/21 b:</strong><br>
  Found the solution, see my answer below.</p>