By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,248 Members | 1,979 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,248 IT Pros & Developers. It's quick & easy.

Coloring check box list controls Client side

P: n/a
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

Nov 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.