Implementation code _ PHP

Source: Internet
Author: User
On the production line, the input efficiency of the input personnel is improved. before the Barcode gun is purchased, the program needs to be modified, that is, when the mouse cursor leaves the TextBox, the data is automatically submitted to the database to solve this problem, you must use onblur. The following code is not a project implementation code, but a simulation of the same function.
The code is as follows:














. Aspx. cs:
The code is as follows:
Using System;
Using System. Collections. Generic;
Using System. Drawing;
Using System. Linq;
Using System. Web;
Using System. Web. UI;
Using System. Web. UI. WebControls;
Using Insus. NET;
Public partial class _ Default: System. Web. UI. Page {
Protected void Page_Load (object sender, EventArgs e)
{
Data_Binding ();
}
Private void Data_Binding ()
{
}
Protected void linkbutton#click (object sender, EventArgs e)
{
// Write and submit it to the database
// Below is the Demo usage
InsusJsUtility objJs = new InsusJsUtility ();
If (string. IsNullOrEmpty (this. TextBox1.Text. Trim ()))
{
ObjJs. JsAlert ("no data can be submitted. ");
Return;
}
ObjJs. JsAlert ("data submitted:" + this. TextBox1.Text );
}
}

In the Demo above, you still need to click the LinkButton to submit data. To enable the onblur of TextBox to execute the same event of LinkButton, you only need to find "_ doPostBack ()" of LinkButton ()". We can view the source code on the run page:


Add the highlighted yellow code to TextBox as an onblur event. The following code is written to Data_Binding () of. aspx. cs.
The code is as follows:
This. TextBox1.Attributes. Add ("onblur", "_ doPostBack ('linkbutton1 ','')");

Finally, we need to change the Text = "Submit" of the LinkButton to Text = "" to hide the LinkButton.

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.