ASP.NET Web Forms - HTML Forms
All server controls must appear within a
**Note:** The form is always submitted to its own page. If you specify an action attribute, it is ignored. If you omit the method attribute, it is set to method="post" by default. Also, if you do not specify the name and id attributes, they are assigned automatically by ASP.NET.
**Note:** An .aspx page can only contain one
Submitting a Form
Forms are usually submitted by clicking a button. The format of the Button server control in ASP.NET is as follows:
The id attribute defines a unique name for the button, and the text attribute assigns a label to the button. The onClick event handler specifies a named subroutine to be executed.
In the example below, we declare a button control in an .aspx file. A single mouse click runs a subroutine that changes the text on the button.