Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

ASP.NET Button Control

ASP.NET Web Forms - Button Control


The Button control is used to display a push button.


Button Control

The Button control is used to display a push button. A push button may be a submit button or a command button. By default, this control is a submit button.

A submit button has no command name; when it is clicked, it posts the page back to the server. You can write some event handlers that control the execution of actions when the submit button is clicked.

A command button has a command name and allows you to create multiple Button controls on a page. You can write some event handlers that control the execution of actions when the command button is clicked.

The features and properties of the Button control are listed on our WebForms Controls Reference Manual page。

The example below demonstrates a simple Button control:


Add Script

Forms are usually submitted by clicking a button.

In the example below, we declare a TextBox control, a Button control, and a Label control in the .aspx file. When the submit button is triggered, the submit subroutine is executed. The submit subroutine writes a line of text into the Label control:

Example

Enter your name:

Demo Example »