|
-
Oct 9th, 2003, 10:35 PM
#1
Thread Starter
Lively Member
Disable ASPX Submit button after click
Hi,
I have an ASPX submit button
The processing behind the click event takes a small amount of time - I want to disable the button on the client side so that the button cannot be clicked again until processing has finished ...
I've seen a few blogs on this but non of them seem to work ..
Any ideas?
Cheers,
Tim
-
Oct 10th, 2003, 11:18 AM
#2
Instead of using the submit button directly, make it non-visible.
Then, place another non-runat-server button on the page with your own onClick event handler.
In that event handler, spoof the event handler for your now-hidden button.
It usually looks something like:
__doPostback("buttonName")
You can find it by looking at your source code.
If this button is the default submit button for the form, then instead of doing that, just submit the form in your event handler:
Form1.submit();
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Oct 10th, 2003, 11:20 AM
#3
And the part I forgot to mention:
When you take care of posting the form in your custom event handler, make sure to disable the other button...
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Oct 20th, 2003, 12:39 AM
#4
Thread Starter
Lively Member
Thanks LR - that worked a treat...
Code:
<script language="javascript">
function ufSaveButtonClick() {
document.getElementById('btnOK').disabled=true;
__doPostBack('cmdOK','');
}
</script>
.....
<BUTTON id="btnOK" style="FONT-SIZE: x-small; WIDTH: 65px" onclick="ufSaveButtonClick();type="button">OK</BUTTON>
<asp:button id="cmdOK" runat="server" Width="65" Text="OK" Visible="False"></asp:button></CENTER>
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|