Greetings!
I've created a custom button class to render the following:
<span class="btnOrange">
<input type="submit" id="ctl00_MainContent_m_GoBack" value="Back" name="ctl00$MainContent$m_GoBack"/>
</span>
However, it renders like this instead (note the extraneous "class" attribute in the INPUT tag):
<span class="btnOrange">
<input type="submit" class="btnOrange" id="ctl00_MainContent_m_GoBack" value="Back" name="ctl00$MainContent$m_GoBack"/>
</span>
My custom button class looks like this:
[ToolboxData(@"<{0}:MyButton runat=server></{0}:MyButton>")]
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);
}
}
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?