表单只允许提交一次:在提交前把提交按钮设置成disable即可。
有两点需要注意:

一是页面验证没通过不能disable;

二是submit类型的按钮disable后,服务器端提交事件不能触发,只能用button类型的按钮。

function clickOnce(btn, msg) {
if (typeof(Page_ClientValidate) == 'function') { if (Page_ClientValidate() == false) {

// Ensure that the button is not of type "submit" 

if (btn.getAttribute('type') == 'button') { 
if (!msg || (msg=='undefined')) { msg = 'Loading...'; } 
btn.value = msg; 
tn.disabled = true

return true

 


<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="OnceClickMe" ValidationGroup="SubgurimTest"  UseSubmitBehavior="false" OnClientClick="clickOnce(this, '......')" /> 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
  • 2021-09-18
  • 2022-12-23
  • 2021-07-25
猜你喜欢
  • 2021-06-04
  • 2022-01-22
  • 2022-12-23
  • 2021-05-06
  • 2021-09-29
  • 2021-09-30
相关资源
相似解决方案