title: Problems in the global namespace when I try to use my custom server control (in the App_Code directory)
body: <p>Traditionally I use the regular asp.net website (created using the File > New Website).  Recently, I opted to work off of a full fledged project (created using File > New Project > ASP.net Web Application).</p>
  
  <p>I've been using the same custom controls for years without incident.  I simply create the new website, place my CustomControls.cs file in the App_Code directory, add one line to the web.config file and I can use all of my custom server controls.
  When I try that with my web project I get the following error</p>
  
  <blockquote>
    <p>Error 225 The
    type or namespace name 'DTF' could not
    be found in the global namespace (are
    you missing an assembly
    reference?)   D:[Project Location On
    Drive]\AgIn02.aspx.designer.cs</p>
  </blockquote>
  
  <p>My custom control file looks like this</p>
  
  <pre><code>using System;
  using System.Web;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using AjaxControlToolkit;
  using System.Text;
  using System.IO;
  using System.Text.RegularExpressions;
  
  namespace DTF.Web.UI
  {
  
      public class IntOnlyBox : TextBox
      {
          private RequiredFieldValidator rfv;
          private ValidatorCalloutExtender vce;
          private AjaxControlToolkit.FilteredTextBoxExtender ftb;
          private string strInvalidMessage = "";
          private string strValidationGroup = "";
  
          public string ValidationGroup
          {
              get
              {
                  return strValidationGroup;
              }
              set
              {
                  strValidationGroup = value;
              }
          }
  
  
          public string InvalidMessage
          {
              get
              {
                  return strInvalidMessage;
              }
              set
              {
                  strInvalidMessage = value;
              }
          }
  
          protected override void OnInit(EventArgs e)
          {
              rfv = new RequiredFieldValidator();
              rfv.ControlToValidate = this.ID;
              rfv.ErrorMessage = "&lt;span style=\"color:black\"&gt;&lt;b&gt;Required Field Missing&lt;/b&gt;&lt;br /&gt;" + this.InvalidMessage + "&lt;/span&gt;";
              //rfv.ErrorMessage = this.InvalidMessage;
              rfv.ID = "rfv" + this.ID;
              rfv.Display = ValidatorDisplay.None;
              rfv.SetFocusOnError = true;
              rfv.EnableClientScript = true;
              rfv.ValidationGroup = this.ValidationGroup;
  
              vce = new AjaxControlToolkit.ValidatorCalloutExtender();
              vce.ID = "vce" + this.ID;
              vce.TargetControlID = "rfv" + this.ID;
              vce.Width = 300;
  
              ftb = new FilteredTextBoxExtender();
              ftb.ID = "ftb" + this.ID;
              ftb.TargetControlID = this.ID;
              ftb.FilterType = FilterTypes.Numbers;
  
              Controls.Add(rfv);
              Controls.Add(vce);
              Controls.Add(ftb);
          }
  
          protected override void Render(HtmlTextWriter w)
          {
              //w.Write(this.InvalidMessage);
              base.Render(w);
              rfv.RenderControl(w);
              vce.RenderControl(w);
              ftb.RenderControl(w);
          }
      }
  
  }
  </code></pre>
  
  <p>my web.config entry looks like this (in the pages/controls area)</p>
  
  <pre><code>&lt;add tagPrefix="DTF" namespace="DTF.Web.UI" /&gt;
  </code></pre>
  
  <p>I've tried everything I can think of to get this to work and compile.  The intellisense for the custom server controls works fine, it simply won't compile.</p>
  
  <blockquote>
    <p>I also get the error "The base class
    includes the field 'blanro', but its
    type (DTF.DateBoxFull) is not
    compatible with the type of control
    (DTF.DateBoxFull)."</p>
  </blockquote>
  
  <p>Any idea how to fix this, and why it would work in the regular asp.net website but not in a web project?</p>
  
  <p>Thanks Everyone.</p>