The solution maily depends on your client's browser capabilities...
If you can ensure that javascript is enabled, then you can add the
following script:
C#:
yourButton.Attributes.Add( "onClick='yourButton.enabled=false;'");
The problem is if your site is public and you cannot ensure that your
clients all have javascript enabled!
In that case, you can only rely on server side code, and you have to
ensure that if 2 posts came from the same client, all but the 1st will
be ignored!
[quoted text, click to view] Stuart Quinn wrote:
> Is there a way to disable a button to disallow a user to click on it more
> than once?
>
> Thanks!
[quoted text, click to view] jmnobre wrote:
> The solution maily depends on your client's browser capabilities...
> If you can ensure that javascript is enabled, then you can add the
> following script:
>
> C#:
> yourButton.Attributes.Add( "onClick='yourButton.enabled=false;'");
>
> The problem is if your site is public and you cannot ensure that your
> clients all have javascript enabled!
> In that case, you can only rely on server side code, and you have to
> ensure that if 2 posts came from the same client, all but the 1st will
> be ignored!
>
>
>
> Stuart Quinn wrote:
>> Is there a way to disable a button to disallow a user to click on it
>> more than once?
>>
>> Thanks!
If you also want to disable pressing the Enter key twice, you need
to move the script to the onSubmit event of the form.
Some of the caveats are discussed in a part of this article:
http://msdn.microsoft.com/msdnmag/issues/06/09/CuttingEdge/default.aspx#S3 --
Riki
This will stop multiple submits.
I got this from this newsgroup and always
wanted to thank the author but could not locate the post..
--aspx code--
<script type="text/javascript">
var submitFlag = false;
</script>
--end code--
--Page Load code--
Submit.Attributes.Add("onclick", "javascript:if(submitFlag){return
false;}else{submitFlag=true;return true;}")
--end code--