I’ve been injecting this jQuery code from the code behind of a .net user control… It has occurred to me that this application of jQuery could have been accomplished using AJAX… I’m still doing a postback… I’m curious as to how I might be able to get this code to execute whenever there is a change on the page and not have to inject?
Protected _picklistColorScriptText As String = "$(document).ready(function(){ " + _
"$('[id ^= ""usrControl""]:visible:disabled').css(""background-color"", '#DCDCDC'); " + _
"$('[id ^= ""usrControl""]:visible:enabled').css(""background-color"", '#FFFFFF');" + _
"});"
Put the JS/jQuery code in the pageLoad function instead of (document).ready in the html instead of in the code behind. pageLoad will fire on all postbacks.