Sunday, March 11, 2012

ajax slider control with BG color

Hi,

You can hook up a client side JS event handler to the valueChanged event for the Slider and then change the BG colour of the cell depending on the value of the textbox that is associated with the slider, e.g.

function pageLoad(){ var slider = $find('SliderClientID'); slider.add_valueChanged(myHandler);}function myHandler(){ var textBox = $get('SliderTextBoxClientID'); var cell = $get('CellClientID');if (textBox.value == 0) { cell.style.backgroundColor ='white'; }else { cell.style.backgroundColor ='red'; }}

Cheers,
Jason

Hey Jason

I was hoping for something, but my apologizies I just realized I didn't full explain it properly. I was hoping to have 3 bars ( hue, color,contrast?) and have them adjust so they can create any color from "#000000" to "#FFFFFF"

Thanks for your help!

mike123


Sure, my example was only simplistic in its colour selection, but can't you just extend upon it to use the values from the 3 sliders and calculate the correct BG colour? I say that without knowing how to actually translate from your proposed hue colour contrast into RGB but I would imagine that Google would have that answer!!


Your example will help me perfectly for the first part yes, thanks for that. I don't know how to change the the values either, if anyone knows it would be much apprecaited.

thanks again! :)

mike123


How about this:http://www.codeproject.com/dotnet/HSBColorClass.asp
perfect, thanks!! :)

No comments:

Post a Comment