Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Andrzejek on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add css class attribute to a checkbox control

Status
Not open for further replies.

Kai77

Programmer
Jun 7, 2004
77
NL
I am trying to assign a CSS class named "checkbox" to my checkbox. I have tried both the .Attribute.Add and the .Attribute.AddAtributes methods.

But I keep getting this:
<span class="checkbox"><input id="_ctl17_cbBrochure" type="checkbox" name="_ctl17:cbBrochure" checked="checked" /></span>

It creates a span around the control with the class name. Whereas I would like it to be like this:

<input class="checkbox" id="_ctl17_cbBrochure" type="checkbox" name="_ctl17:cbBrochure" checked="checked" />
 
is there a reason that you're not using an asp:checkbox?

Code:
<asp:CheckBox id="CheckBox1" style="Z-INDEX: 111; LEFT: 560px; POSITION: absolute; TOP: 144px" runat="server" CssClass="chkboxClass"></asp:CheckBox>

"...we both know I'm training to become a cagefighter...see what happens if you try 'n hit me..."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top