Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

Change Background Color with jQuery -


i have form multiple drop downs... set background color of visible dropdowns gray when disabled. of these dropdown's id's begin usrcontrol. here have far..

    $('select[id ^= "usrcontrol"]:visible').each(function(){ this.css("background-color") }); 

not sure how disabled/enabled selectors.

thanks in advance alt text

protected _picklistcolorscripttext string = "$(document).ready(function(){ " + _                                                 "$('[id ^= ""usrcontrol""]:visible:disabled').css(""background-color"", '#dcdcdc'); " + _                                                 "$('[id ^= ""usrcontrol""]:visible:enabled').css(""background-color"", '#ffffff');" + _                                                 "});" 

this works. however, sets background entire control gray, how can change color of selected item gray?

you can use :disabled pseudo-selector. plus don't need jquery.each. work against returned nodeset.

$('select[id ^= "usrcontrol"]:visible:disabled').css("background-color", 'gray'); 

working example here: http://jsfiddle.net/cwm4w/

update: responding op's clarification below, can select contained option so:

$('select[id ^= "usrcontrol"]:visible:disabled option').css("background-color", 'gray'); 

working example here: http://jsfiddle.net/cwm4w/1/


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -