944,051 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 6590
  • ASP.NET RSS
Feb 3rd, 2006
0

ASP.NET Timer Button

Expand Post »
I would like to code my submit web control button with a timer on it. Its suppose to allow submission until time goes up and the button is disabled from submission. Any directions or tutorials on this?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Naters_uk is offline Offline
50 posts
since Jun 2005
Feb 3rd, 2006
0

Re: ASP.NET Timer Button

easiest way is javascript
ASP.NET Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <script language="JavaScript">
  4. <!--
  5. function setDisableButtonTimer(){
  6. disableButtonTimer = setInterval("disableButton()", 5000);
  7.  
  8. }
  9.  
  10. function disableButton(){
  11. document.form1.btnSubmit.disabled = true;
  12. clearInterval(disableButtonTimer);
  13. }
  14.  
  15. -->
  16. </script>
  17.  
  18. </head>
  19. <body onload="setDisableButtonTimer();">
  20.  
  21. <FORM ACTION="test.asp" METHOD="POST" name="form1" >
  22. <SELECT NAME="MyListBox" Size="11" MULTIPLE>
  23. <OPTION VALUE="0">CustomerID
  24. <OPTION VALUE="1">CompanyName
  25. <OPTION VALUE="2">ContactName
  26. <OPTION VALUE="3">ContactTitle
  27. <OPTION VALUE="4">Address
  28. <OPTION VALUE="5">City
  29. <OPTION VALUE="6">Region
  30. <OPTION VALUE="7">PostalCode
  31. <OPTION VALUE="8">Country
  32. <OPTION VALUE="9">Phone
  33. <OPTION VALUE="10">Fax
  34. </SELECT><P>
  35. <INPUT TYPE=submit name="btnSubmit" >&nbsp;&nbsp
  36. <INPUT TYPE=reset>
  37. </FORM>
  38. </body>
  39.  
  40. </html>
Reputation Points: 14
Solved Threads: 19
Posting Pro in Training
campkev is offline Offline
484 posts
since Jul 2005
Feb 6th, 2006
0

Re: ASP.NET Timer Button

<!--
function setDisableButtonTimer(){
disableButtonTimer = setInterval("disableButton()", 5000);

}

function disableButton(){
document.form1.btnSubmit.disabled = true;
clearInterval(disableButtonTimer);
}

-->
</script>

</head>
<body onload="setDisableButtonTimer();">


Campkev, are the above the essential parts i need to have in the html page? Also how do i run the script for the ASP.NET web control button since i have to call 2 functions?
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Naters_uk is offline Offline
50 posts
since Jun 2005
Feb 6th, 2006
0

Re: ASP.NET Timer Button

here is a whole web page to give you the idea
ASP.NET Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <script language="JavaScript">
  4. <!--
  5. function setDisableButtonTimer(){
  6. disableButtonTimer = setInterval("disableButton()", 5000);
  7.  
  8. }
  9.  
  10. function disableButton(){
  11. document.form1.btnSubmit.disabled = true;
  12. clearInterval(disableButtonTimer);
  13. }
  14.  
  15. -->
  16. </script>
  17.  
  18. </head>
  19. <body onload="setDisableButtonTimer();">
  20.  
  21. <FORM ACTION="test.asp" METHOD="POST" name="form1" >
  22. <SELECT NAME="MyListBox" Size="11" MULTIPLE>
  23. <OPTION VALUE="0">CustomerID
  24. <OPTION VALUE="1">CompanyName
  25. <OPTION VALUE="2">ContactName
  26. <OPTION VALUE="3">ContactTitle
  27. <OPTION VALUE="4">Address
  28. <OPTION VALUE="5">City
  29. <OPTION VALUE="6">Region
  30. <OPTION VALUE="7">PostalCode
  31. <OPTION VALUE="8">Country
  32. <OPTION VALUE="9">Phone
  33. <OPTION VALUE="10">Fax
  34. </SELECT><P>
  35. <INPUT TYPE=submit name="btnSubmit" >&nbsp;&nbsp
  36. <INPUT TYPE=reset>
  37. </FORM>
  38. </body>
  39.  
  40. </html>
Last edited by campkev; Feb 6th, 2006 at 11:05 am. Reason: added code tags
Reputation Points: 14
Solved Threads: 19
Posting Pro in Training
campkev is offline Offline
484 posts
since Jul 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Disable ASP.NET Button from Listbox
Next Thread in ASP.NET Forum Timeline: How to end a session immediately when the browser closes?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC