This client side script is being added to buttons in our existing codebase. It basically shows a pop-up that the system is busy whenever a long running process is occuring. this works fine for buttons, however the btn.disabled = true line causes the SelectedIndexChanged event to never fire(when using it on a button, the click even still fires). If I comment out that line, it fires fine. The object is disabled to prevent double clicking. Any ideas on why its not firing? This code is being registered as a client script block, so any changes affect all of the buttons using this code on a page.
@"<script language='javascript' type='text/javascript'>
function BB(btn, msg, btnID)
{
bb1 = new BusyBox('iBB1', 'bb1', 4, '" + ContentImageUrlPath +
@"/gears_ani_', '.gif', 125, 147, 207, msg);
btn.disabled = true;
bb1.Show();
__doPostBack(btnID,'');
return false;
}</script>";
Here is the code as seen on the page
<select id="foo" onchange="return BB(this,
'Processing','ddlRoadsAssessment');
setTimeout('__doPostBack(\'foo\',\'\')', 0)" name="foo">
Well yes, if it’s disabled, then .NET will assume that it has not changed, and won’t even look at the value being posted. You’ll have to manually check
Request.Form[ddlRoadsAssessment.ClientID](in, say,OnInit) and compare that to its previous value (which you could store, for instance, in viewstate), and if they don’t match, manually invoke a method.