ASP. NET page button click event invalidation Solution

Source: Internet
Author: User

Today, when I run the previous project again, I find that the Click Event of the button does not work. After the breakpoint is added, I find that the event is not triggered at all ....

According to the answers found on the Internet, some people say that they should delete the controls and drag them in again. Although they have encountered a previous failure of the controls and the re-drag operation was valid, it did not work this time.

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

Inadvertently, I tried to add a client click event in the button:
Copy codeThe Code is as follows:
OnClientClick = "return true"

Effective:
Copy codeThe Code is as follows:
<Asp: ImageButton ID = "imgSearch" runat = "server"
ImageUrl = "~ /Images/iconSearch.png "OnClientClick =" return true "onclick =" imgSearch_Click "style =" margin-top: 5px; "/>

Although I still don't know the specific reason, I am very happy to take effect after all.

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.