Prevent refresh recurring Refresh Submit resolution

Source: Internet
Author: User

Prevent refresh recurring Refresh Submit resolution

Method One: Test the data table to see if there is the same data. This approach may be more meaningful to insert data, but it's a hassle to define the same data. At the same time, if the data is not inserted, it is deleted, it does not apply.

Method Two: After submitting, turn to a transition page, and then return to the current page from the transition page. This requires that after the submission, the current page URL address as a parameter pass, and can not save the cache, or "back" brings adverse consequences. However, if it is simple to delete, it seems too troublesome to wander around.

Method Three: Capture F5 events with web effects. For example, you have the following code:

Window.document.onkeydown = keystroke;
function keystroke ()
{
var key = Event.keycode;
Event.srcelement.releasecapture ();
if (key = = 116)
{
event.keycode=0;
Event.returnvalue=false;
}
}

Workaround Four:

Front button:

<asp Tutorial: Button id= "button1" runat= "Server" onclick= "Button1_Click" button "text=" onclientclick= M.submit (); This.disabled=true "usesubmitbehavior= false"/>

Background code:

protected void Page_Load (object sender, EventArgs e)
{
if (Page.IsPostBack)
{
Button1.attributes.add ("Disabled", "disabled");
}
}


The key is the red part onclientclick= "This.form.submit (); This.disabled=true" usesubmitbehavior= "false".


Workaround Five:

this.btnsubmit.attributes["onclick"] = this.getpostbackeventreference (this.btnsubmit) + "; this.disabled=tr     UE; "; Prevent duplicate submissions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.