The server control cannot trigger the onclick event in HTML!

Source: Internet
Author: User
The problem that has plagued me for a long time is that the server control cannot write the oncick event of the button in HTML. It is actually quite simple in winter. Haha, because I am a beginner.

This is JS in HTML. I want to trigger it when I click the button, but the runat = "server" button prompts this error. After several twists and turns, I finally found a solution, haha. In the background file, that is, your XXX. CS
Private void page_load (Object sender, system. eventargs E)
{
// Place the user here CodeTo initialize the page
This. namecheck. Attributes. Add ("onclick", "Return checkinput ();");
}
Page_load. Add this. namecheck. Attributes. Add ("onclick", "Return checkinput ();");
This is OK, so that you can trigger checkinput () first (). It may be vague, but I think it should be understandable if someone encounters the same problem as me.
New handwriting is inevitable. Please teach me more!

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.