.NET 解决重复提交问题
1.在ASPX页面下加一个隐藏域 <asp:HiddenField ID="HidSign" runat="server" />
2.cs代码
protected void Page_Load( object sender, EventArgs e) { if (!IsPostBack) { UpdateSign(); } } static string rp_GoodsEdit; public void UpdateSign() { HidSign.Value = DateTime.Now.ToString( "ffffff" ); rp_GoodsEdit = HidSign.Value; } // |
protected void btnSave_Click( object sender, EventArgs e) { if (rp_GoodsEdit == HidSign.Value) { UpdateSign(); } else { this .ClientScript.RegisterStartupScript( this .GetType(), "startup" , "alert('请勿重复提交!');self.parent.tb_remove('reload');" , true ); UpdateSign(); return ; } ................ } |
生活不是用眼泪博得同情 而是用汗水赢得掌声