title: Removing CSS Class Attribute From Tag in a Custom Server Control
body: <p>Greetings!</p>
  
  <p>I've created a custom button class to render the following:</p>
  
  <pre><code>&lt;span class="btnOrange"&gt;
      &lt;input type="submit" id="ctl00_MainContent_m_GoBack" value="Back" name="ctl00$MainContent$m_GoBack"/&gt;
  &lt;/span&gt;
  </code></pre>
  
  <p>However, it renders like this instead (note the extraneous "class" attribute in the INPUT tag):</p>
  
  <pre><code>&lt;span class="btnOrange"&gt;
      &lt;input type="submit" class="btnOrange" id="ctl00_MainContent_m_GoBack" value="Back" name="ctl00$MainContent$m_GoBack"/&gt;
  &lt;/span&gt;
  </code></pre>
  
  <p>My custom button class looks like this:</p>
  
  <pre><code>[ToolboxData(@"&lt;{0}:MyButton runat=server&gt;&lt;/{0}:MyButton&gt;")]
  public class MyButton : Button
  {
      public override void RenderBeginTag(HtmlTextWriter writer)
      {
         writer.AddAttribute(HtmlTextWriterAttribute.Class, this.CssClass);   
         writer.RenderBeginTag("span");
         base.RenderBeginTag(writer);
      }
  
      public override void RenderEndTag(HtmlTextWriter writer)
      {
         writer.RenderEndTag();
         base.RenderEndTag(writer);
      }
  }
  </code></pre>
  
  <p>Since I only need to set the class attribute for the SPAN tag, is it possible to not include or "blank out" the class attribute for the INPUT tag?</p>