Modify elemts in a listbox when binding.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello.

I have a listbox that has about 600 or so items in. I bind it to a dataset
and all is fine. However, i need to modify some of the elements colour
depending on the value from the DB. Ideally, ItemDataBound would work, but
the list box has no ItemDataBound.

How could this be achieved?

Thanks,

Jon
 
Jon,

With the standard HTML <SELECT> element (which is what a dropdown is) you
just can't do that.

With enough work you could build a replacement for <SELECT> that looks
pretty similar to a <SLEECT> and offers the features you need.

It might also be worth looking at third party controls. Some of the more
ajax'y ones might have something like this.

You could also consider a user interaction redesign. A dropdown with 600
entries could be considered cumbersome by some. Are the element colors to
make certain commonly used elements easier to pick? Maybe you need a "...
more... " element choice that shows/hides a second dropdown of rarely used
choices. Or something... :)

Regards,

Rob MacFadyen
 
Back
Top