TButton creates a click button on the page. It is mainly used to submit data to a page.
TButton raises two server-side events, {@link onClick OnClick} and {@link onCommand OnCommand},
when it is clicked on the client-side. The difference between these two events
is that the event {@link onCommand OnCommand} is bubbled up to the button's ancestor controls.
And within the event parameter for {@link onCommand OnCommand} contains the reference
to the {@link setCommandName CommandName} and {@link setCommandParameter CommandParameter}
property values that are set for the button object. This allows you to create multiple TButton
components on a Web page and programmatically determine which one is clicked
with what parameter.
Clicking on button can also trigger form validation, if
{@link setCausesValidation CausesValidation} is true.
The validation may be restricted within a certain group of validator
controls by setting {@link setValidationGroup ValidationGroup} property.
If validation is successful, the data will be post back to the same page.
TButton displays the {@link setText Text} property as the button caption.
TButton can be one of three {@link setButtonType ButtonType}: Submit, Button and Reset.
By default, it is a Submit button and the form submission uses the browser's
default submission capability. If it is Button or Reset, postback may occur
if one of the following conditions is met:
- an event handler is attached to {@link onClick OnClick} event;
- an event handler is attached to {@link onCommand OnCommand} event;
- the button is in a non-empty validation group.
In addition, clicking on a Reset button will clear up all input fields
if the button does not cause a postback.