>>Hmm. Quick test:
protected void Page_Load(object sender, EventArgs e)
>> {
>> theButton.Attributes.Add("onClick", "this.disabled=true; document.Form1.submit(); return false;");
>> //theButton.Attributes.Add("onClick", "document.Form1.submit(); this.disabled=true; return false;");
>>
>> if (IsPostBack)
>> {
>> int i = 0;
>> // If 'disabled' is first: Firefox - works. button disabled, postback
>> // Chrome - button disabled, no postback
>> // If 'submit' is first : Firefox - postback, button not disabled
>> // Chrome - postback, button not disabled
>> }
>> }
Didn't test IE...
>>>
>>>But, despite the fact that this no support was only referencing to other controls, I believe it might have applied also to buttons. The situation might be caused because of the usage of "true" instead of "disabled". That is why I need to complete the installation of IE, currently in progress, and take a look at this.
>>
>>Pls let us know what you find
>
>Before proceeding with more tests, can you adjust your code for "onclick" instead of "onClick"? I will only be able to test with IE 7 in about an hour. But, I think IE 7 might be case sensitive on that one. That would then explain the situation.
Case makes no difference. Couple of other things:
Safari behaviour is the same as for Chrome except:
With Chrome when 'submit' is first then subsequent clicks will queue the request so that postback is fired multiple times.
With IE the above code shows a null reference exception on the browser for 'document.Form1.submit();' , In this case if 'UseSubmitBehavior' is false then postback doesn't fire; if 'true' it does.
This code works as required with all of the above browsers (regardless of whether the submit or disable fires first):
<script>
function btnClick() {
var b = document.getElementById("theButton");
b.disabled = true;
var f = document.getElementById("Form1");
f.submit();
}
</script>
and
theButton.Attributes.Add("onclick", "javascript:btnClick()");
I'd suggest using this instead.