黑马程序员技术交流社区
标题:
Asp.Net 防止重复提交方案
[打印本页]
作者:
380933512
时间:
2012-11-3 23:45
标题:
Asp.Net 防止重复提交方案
本帖最后由 380933512 于 2012-11-4 09:52 编辑
解决方法一:
.Framework2.0中才有的button属 性:<asp:button id="Button2" runat="server" OnClientClick="this.disabled=true; this.form.submit();" UseSubmitBehavior="False" />
解决重复提交:OnClientClick="this.disabled=true;this.form.submit();" UseSubmitBehavior="False"
解决方法二:
this.Button3.Attributes["onclick"] =
this.GetPostBackEventReference
(this.Button3) + "; this.disabled=true;"; //防止重复提交
客户端代码的不同:
其中button1为简单的default button
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2