title: Override Text Property to auto trim Textbox value
body: <p>I want to override the <code>Text</code> property of a textbox to set its value as auto trimmed. For that, I had to define the following class:</p>
  
  <pre><code>public class TextBox : System.Web.UI.WebControls.TextBox
  {
      public override string Text
      {
          get { return base.Text.Trim(); }
  
          //Automatically trim the Text property as it gets assigned
          set { base.Text = value.Trim(); }
      }
  }
  </code></pre>
  
  <p>But the issue is that it's not working for TextBoxes defined in a design page (.aspx) and it only works for dynamically created Textboxes.</p>
  
  <p>I need such code that returns a trimmed value for all TextBoxes whether it is added dynamically or statically.</p>
  
  <p>How can I fix this?</p>