/!\ How to colorize selected checkbox in checkboxlist control ?

F

Francois Verbeeck

Dear UseNet readers,

Does anyone have any idea on how to colorize selected checkbox in
checkboxlist control ?

I've quite a huge checkboxlist (approximatively one full screen) and,
to improve user's experience, i wanted to highlight selected choices.
Does anyone know how to that ?

I can successfully do that on a datagrid by adding some code during
the ItemDatabound process

....
e.Item.Attributes.Add("onmouseover","this.style.backgroundColor='WhiteSmoke'");
....

but there is no "ItemDataBound function on the checkboxlist :( I tried
to do it on the SelectedIndexChanged but without success (i can't cast
a ListItem to a checkbox list so i'm not able to set a BackColor
property :(

Anyone knows a css trick to do that ? the right javascript code to add
at the right time ? I've been learning asp.net since only 2 months and
i feel sorry to ask such basic / pointless questions

Maybe i'll have to create a small datagrid with a hidden datavalue
column, a checkbox column and a datatextfield label column to cheat
this ...

Hope anyone can help.

Best Regards.
 

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

Top