HTML control and Web Control event handle

Source: Internet
Author: User

On the Asp.net page, we can use HTML controls and Web controls. Control executableProgramIncluding client programs (JS scripts) and server programs (server programs ). Client JS ProgramEarlierServer-side program execution.

HTML Control

Add the runat = "server" attribute to the HTML form element to the HTML control.

Traditional events of HTML form elements can trigger JS scripts. However, to trigger server events, you must add "server"

For example: onclick = "" triggers JS scripts, onserverclick = "" triggers server programs

 

Web controls

Web controls are a group of powerful. Net-optimized controls.

Web controls can trigger JS scripts or server programs. Traditional events are mainly used to trigger server programs. To trigger JS programs, you must add "client" to the events"

For example, onclick = "" triggers server programs, and onclientclick triggers JS scripts.

 

JS scripts and server programs

When we click the button, the JS script will be triggered on the client first, and then the server program will be executed.

Sometimes we need to use JS scripts to determine whether to execute the server program. We need the JS script to return the bool value. If it is true, the server program is executed. If it is false, the server program is not executed.

For example, onclientclick = "javascript: Return mybtn_onclick ();" in the mybtn_onclick () script, we will return true/false.

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.