Asp. NET page button Click event Failure resolution _ Practical Tips

Source: Internet
Author: User
Today, when you run a previous project again, the Discovery button's Click event does not work, and after the breakpoint it is found that the event was not triggered at all ....

According to the answers found on the internet, some said that the control deleted to drag a go in, although the control has also been broken before, the time to drag and drop effectively, but this time did not work.

Then, continue to find the answer, some say it may be form nesting, but see the source code does not have this problem.

Inadvertently, try adding a client Click event to the button:
Copy Code code as follows:

Onclientclick= "return True"

It works:
Copy Code code as follows:

<asp:imagebutton id= "Imgsearch" runat= "Server"
Imageurl= "~/images/iconsearch.png" onclientclick= "return True" onclick= "Imgsearch_click" style= "margin-top:5px"/ >

Although still do not know the specific reason is what, but after all work, still very happy.
Related Article

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.