asp.net about Onpropertychange and Oninput Event Implementation Code _ Practical Tips

Source: Internet
Author: User
The whole idea is that when the value of the text box is changed, the event is triggered and the values in the list are filtered.

According to this idea, the first thing to be solved is to determine what events in the text box can meet the requirements, when the first thought is onkeydown or onkeypress, in the process of the trial found again input Chinese, can not respond, because the input side will focus to shield. Searching the internet for a while Onpropertychange events will start when you change text attributes, so when you enter data in a text box it is actually changing the value property of the text box. And Chinese can also be satisfied, this thought is done, finally found this event for IE exclusive event, other browsers do not have the event. and the corresponding oninput can satisfy the demand.


The concrete implementation is that the text box, the hidden button, when the text box is entered, calls the Onpropertychange or Oninput event, finds the hidden button in this event, and then departs his click event, In this way we only need to filter the list data in the Click event of the Hidden button in the background (of course, the event of the starting and hiding button is done with JavaScript, and the Clienid of the server-side control in the foreground) script code is as follows:

Copy Code code as follows:

<script type= "Javascript/text" language= "JavaScript" >
function Btnclick ()
{
var Btnid = "<%=this.btnSearch.ClientID%>";
var btnobject = Document.getelementid (Btnid);
if (Btnobject)
{
Btnobject.click ();
}
}
</script>

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.