Coloring check box list controls Client side

  • Thread starter H. Scott Buckwalter
  • Start date
H

H. Scott Buckwalter

ASP.NET: I want to control the color of the text for a check box control in
JavaScript on the client.

I am able to do this by surrounding the check box in a SPAN tag. I then
color the span and the text changes. (as:
document.all.spanname.style.color=color)

The problem is that I want to do this with the individual controls in a
check box list. If I add a span around the check box list control, it's
around all the check boxes in the list, not each check box individually.
So, how do I color the text individually for each check box in the list?

Things that my work if I can get some help doing these:

1) I could create my own CheckBox control derived from the system control.
Then in the Render method, I could write the span tag around the control.
This work wonderfully for individual controls but how do I get the
CheckBoxList control to create these controls instead of the system ones?

2) I could create my own CheckBoxList control derived from the system
control. And have it write the span tags. Or have it create the derived
CheckBox controls. But these solutions means re-writing some CheckBoxList
control's functions (not just augmenting them). That would not be forward
compatible. I could wait until after the check boxes are created and then
get a list of them and up-class them to my derived control (that is, replace
the list with a different list). Not sure if this would work since I don't
now the internals of the CheckBoxList.

Anyone have an idea?

Thanks,
H. Scott Buckwalter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top