title: Base class includes field but type not compatible with type of control
body: <blockquote>
  <p>The base class includes the field 'lbl', but its type (web.App_Code.CustomLabelControl) is not compatible with the type of control (web.App_Code.CustomLabelControl).</p>
  </blockquote>
  <p>I had done many custom controls before the same way but today I ran into this error.</p>
  <p>I have a web application project with the below class in <code>App_Code</code> directory a tagprefix reference in web.config for the control in class.</p>
  <p><strong>What do I do now?</strong></p>
  <h3>Web.Config</h3>
  <pre><code>&lt;system.web&gt;
      &lt;pages&gt;
          &lt;controls&gt;
              &lt;add namespace=&quot;web.App_Code&quot; tagPrefix=&quot;CControls&quot;/&gt;...
  </code></pre>
  <h3>Markup</h3>
  <pre><code>&lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;
  &lt;div&gt;
      &lt;CControls:CustomLabelControl runat=&quot;server&quot; OnClickText=&quot;Welcome&quot; ID=&quot;lbl&quot;&gt;
      &lt;/CControls:CustomLabelControl&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  <h3>Class File</h3>
  <pre><code>namespace web.App_Code
  {
      public class CustomLabelControl : Control, IPostBackEventHandler, IPostBackDataHandler
      {
          private string _onClickText;
  
          public CustomLabelControl()
          {
  
          }
  
          public string OnClickText
          {
              get { return _onClickText; }
              set { _onClickText = value; }
          }
  
          public void RaisePostBackEvent(string eventArgument)
          {
              throw new System.NotImplementedException();
          }
  
  
          public bool LoadPostData(string postDataKey, NameValueCollection postCollection)
          {
              throw new System.NotImplementedException();
          }
  
  
          public void RaisePostDataChangedEvent()
          {
              throw new System.NotImplementedException();
          }
      }
  }
  </code></pre>
  <h3>I've checked these resources already:</h3>
  <ul>
  <li><p><a href="https://stackoverflow.com/questions/3742384/the-base-class-includes-the-field-btnlogin-but-its-type-foodorder-app-code-l">The base class includes the field &#39;btnLogin&#39;, but its type (FoodOrder.App_Code.LinkButtonDefault) is not compatible</a></p>
  </li>
  <li><p><a href="http://support.microsoft.com/kb/919284" rel="nofollow noreferrer">http://support.microsoft.com/kb/919284</a></p>
  </li>
  <li><p><a href="https://stackoverflow.com/questions/582596/the-base-class-includes-the-field-scriptmanager1-but-its-type-system-web-ui">Base class includes the field &#39;X&#39;, but its type (System.Web.UI.ScriptManager) is not compatible with the type of control (System.Web.UI.ScriptManager)</a></p>
  </li>
  </ul>