In ASP.. NET. If you click a button and submit it to the background for execution, you can click the button again. One is to execute the background code twice, the other is to wait for the previous commit action to execute the commit action again. No matter which one is, the background code is run twice, this is not expected in many cases.
The following code passes the test in IE and aoyou extreme speed mode.
Copy codeThe Code is as follows:
<% @ Page Language = "C #" AutoEventWireup = "true" CodeFile = "Default. aspx. cs" Inherits = "_ Default" %>
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head runat = "server">
<Title> ODP connection test </title>
<Script>
Function submitTest (btn ){
Btn. value = "waiting for background data update ";
Btn. onclick = onDealing;
}
Function onDealing (){
Alert ('processing ');
Return false;
}
</Script>
</Head>
<Body>
<Form id = "form1" runat = "server">
<Div>
<Asp: Button ID = "Button1" runat = "server" Text = "register" onclick = "button#click" OnClientClick = "submitTest (this);"/>
</Div>
<Div>
<Asp: GridView ID = "GridView1" runat = "server">
</Asp: GridView>
</Div>
</Form>
</Body>
</Html>