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.
getPostBackOptions()
protected method
This method is used by framework and control developers.
needPostBackScript()
protected method
raisePostBackEvent()
public method
This method is required by {@link IPostBackEventHandler} interface.
If {@link getCausesValidation CausesValidation} is true, it will
invoke the page's {@link TPage::validate validate} method first.
It will raise {@link onClick OnClick} and {@link onCommand OnCommand} events.
This method is mainly used by framework and control developers.
renderContents()
public method
This overrides the parent implementation with nothing to be rendered for input tags,
button tags are rendered normally.