Easy Tutorial
❮ Prop Webcontrol Calendar Cellpadding Prop Webcontrol Literal Text ❯

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. The push button can be a submit button or a command button. By default, this control is a submit button.

A submit button does not have a command name and, when clicked, it posts the page back to the server. You can write event handlers to 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 event handlers to control the execution of actions when the command button is clicked.

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

The following example demonstrates a simple Button control:


Adding Script

Forms are typically submitted by clicking a button.

In the following example, 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 will be executed. The submit subroutine will write a line of text to the Label control:

Example

❮ Prop Webcontrol Calendar Cellpadding Prop Webcontrol Literal Text ❯