Class TCheckBox
Direct Known Sub-classes:
TCheckBox class
TCheckBox displays a check box on the page. You can specify the caption to display beside the check box by setting the Text property. The caption can appear either on the right or left of the check box, which is determined by the TextAlign property. To determine whether the TCheckBox component is checked, test the Checked property. The OnCheckedChanged event is raised when the Checked state of the TCheckBox component changes between posts to the server. You can provide an event handler for the OnCheckedChanged event to to programmatically control the actions performed when the state of the TCheckBox component changes between posts to the server. If AutoPostBack is set true, changing the check box state will cause postback action. And if CausesValidation is true, validation will also be processed, which can be further restricted within a ValidationGroup. Note, Text is rendered as is. Make sure it does not contain unwanted characters that may bring security vulnerabilities.
| Constants Inherited From TControl |
|
AUTOMATIC_ID_PREFIX,
CLIENT_ID_SEPARATOR,
CS_CHILD_INITIALIZED,
CS_CONSTRUCTED,
CS_INITIALIZED,
CS_LOADED,
CS_PRERENDERED,
CS_STATE_LOADED,
ID_FORMAT,
ID_SEPARATOR,
IS_CHILD_CREATED,
IS_CREATING_CHILD,
IS_DISABLE_THEMING,
IS_DISABLE_VIEWSTATE,
IS_ID_SET,
IS_SKIN_APPLIED,
IS_STYLESHEET_APPLIED,
RF_ADAPTER,
RF_AUTO_BINDINGS,
RF_CHILD_STATE,
RF_CONTROLS,
RF_CONTROLSTATE,
RF_DATA_BINDINGS,
RF_EVENTS,
RF_NAMED_CONTROLS,
RF_NAMED_CONTROLS_ID,
RF_NAMED_OBJECTS,
RF_SKIN_ID,
|
| Method Summary |
|
boolean
|
|
|
boolean
|
|
|
boolean
|
|
|
protected
string
|
Gets the name of the javascript class responsible for performing postback for this control.
|
|
boolean
|
Returns the value indicating whether the checkbox is checked.
|
|
boolean
|
Returns a value indicating whether postback has caused the control data change.
|
|
boolean
|
|
|
TMap
|
|
|
bool
|
Returns true if this control validated successfully.
|
|
TMap
|
|
|
protected
array
|
Gets the post back options for this checkbox.
|
|
protected
bool
|
Check if we need a span tag to surround this control. The span tag will be created if the Text property is set for this control.
|
|
string
|
|
|
protected
string
|
|
|
string
|
|
|
TTextAlign
|
|
|
string
|
|
|
mixed
|
Returns the value of the property that needs validation.
|
|
string
|
|
|
protected
string
|
|
|
boolean
|
Loads user input data.
|
|
void
|
Raises OnCheckedChanged event when getChecked changes value during postback.
|
|
void
|
Registers the checkbox to receive postback data during postback.
|
|
void
|
Raises postdata changed event.
|
|
void
|
Renders the checkbox control.
|
|
protected
void
|
Renders the client-script code.
|
|
protected
void
|
Renders a checkbox input element.
|
|
protected
void
|
Renders a label beside the checkbox.
|
|
void
|
Sets a value indicating whether clicking on the checkbox will post the page.
|
|
void
|
Sets the value indicating whether postback event trigger by this checkbox will cause input validation.
|
|
void
|
Sets a value indicating whether the checkbox is to be checked or not.
|
|
void
|
Sets the value indicating whether the checkbox is to be checked or not.
|
|
void
|
|
|
void
|
|
|
void
|
Sets the text caption of the checkbox.
|
|
void
|
|
|
void
|
|
|
void
|
|
| Methods Inherited From TWebControl |
|
TWebControl::addAttributesToRender(), TWebControl::clearStyle(), TWebControl::copyBaseAttributes(), TWebControl::createStyle(), TWebControl::getAccessKey(), TWebControl::getBackColor(), TWebControl::getBorderColor(), TWebControl::getBorderStyle(), TWebControl::getBorderWidth(), TWebControl::getCssClass(), TWebControl::getDisplay(), TWebControl::getFont(), TWebControl::getForeColor(), TWebControl::getHasStyle(), TWebControl::getHeight(), TWebControl::getStyle(), TWebControl::getTabIndex(), TWebControl::getTagName(), TWebControl::getToolTip(), TWebControl::getWidth(), TWebControl::render(), TWebControl::renderBeginTag(), TWebControl::renderContents(), TWebControl::renderEndTag(), TWebControl::setAccessKey(), TWebControl::setBackColor(), TWebControl::setBorderColor(), TWebControl::setBorderStyle(), TWebControl::setBorderWidth(), TWebControl::setCssClass(), TWebControl::setDisplay(), TWebControl::setForeColor(), TWebControl::setHeight(), TWebControl::setStyle(), TWebControl::setTabIndex(), TWebControl::setToolTip(), TWebControl::setWidth()
|
| Methods Inherited From TControl |
|
TControl::addedControl(), TControl::addParsedObject(), TControl::addToPostDataLoader(), TControl::applyStyleSheetSkin(), TControl::autoBindProperty(), TControl::autoDataBindProperties(), TControl::bindProperty(), TControl::broadcastEvent(), TControl::bubbleEvent(), TControl::clearChildState(), TControl::clearControlState(), TControl::clearNamingContainer(), TControl::clearViewState(), TControl::convertUniqueIdToClientId(), TControl::createChildControls(), TControl::createControlCollection(), TControl::dataBind(), TControl::dataBindChildren(), TControl::dataBindProperties(), TControl::ensureChildControls(), TControl::findControl(), TControl::findControlsByID(), TControl::findControlsByType(), TControl::focus(), TControl::getAdapter(), TControl::getAllowChildControls(), TControl::getAttribute(), TControl::getAttributes(), TControl::getChildControlsCreated(), TControl::getClientID(), TControl::getControls(), TControl::getControlStage(), TControl::getControlState(), TControl::getCustomData(), TControl::getEnabled(), TControl::getEnableTheming(), TControl::getEnableViewState(), TControl::getHasAdapter(), TControl::getHasAttributes(), TControl::getHasChildInitialized(), TControl::getHasControls(), TControl::getHasInitialized(), TControl::getHasLoaded(), TControl::getHasLoadedPostData(), TControl::getHasPreRendered(), TControl::getID(), TControl::getNamingContainer(), TControl::getPage(), TControl::getParent(), TControl::getRegisteredObject(), TControl::getSkinID(), TControl::getSourceTemplateControl(), TControl::getTemplateControl(), TControl::getUniqueID(), TControl::getViewState(), TControl::getVisible(), TControl::hasAttribute(), TControl::initRecursive(), TControl::isDescendentOf(), TControl::isObjectRegistered(), TControl::loadRecursive(), TControl::loadState(), TControl::loadStateRecursive(), TControl::onDataBinding(), TControl::onInit(), TControl::onLoad(), TControl::onPreRender(), TControl::onUnload(), TControl::preRenderRecursive(), TControl::raiseBubbleEvent(), TControl::registerObject(), TControl::removeAttribute(), TControl::removedControl(), TControl::render(), TControl::renderChildren(), TControl::renderControl(), TControl::saveState(), TControl::saveStateRecursive(), TControl::setAdapter(), TControl::setAttribute(), TControl::setChildControlsCreated(), TControl::setControlStage(), TControl::setControlState(), TControl::setCustomData(), TControl::setEnabled(), TControl::setEnableTheming(), TControl::setEnableViewState(), TControl::setID(), TControl::setPage(), TControl::setSkinID(), TControl::setTemplateControl(), TControl::setViewState(), TControl::setVisible(), TControl::trackViewState(), TControl::traverseChildControls(), TControl::unbindProperty(), TControl::unloadRecursive(), TControl::unregisterObject(), TControl::__get()
|
| Methods Inherited From TComponent |
|
TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__get(), TComponent::__set()
|
| Method Details |
getAutoPostBack
| public boolean getAutoPostBack |
() |
| Output |
|
boolean
| whether clicking on the checkbox will post the page. |
| Exception |
|
getCausesValidation
| public boolean getCausesValidation |
() |
| Output |
|
boolean
| whether postback event triggered by this checkbox will cause input validation, default is true. |
| Exception |
|
getChecked
| public boolean getChecked |
() |
| Output |
|
boolean
| whether the checkbox is checked |
| Exception |
|
getClientClassName
| protected string getClientClassName |
() |
Gets the name of the javascript class responsible for performing postback for this control.
This method overrides the parent implementation.
| Output |
|
string
| the javascript class name |
| Exception |
|
getData
| public boolean getData |
() |
Returns the value indicating whether the checkbox is checked.
This method is required by IDataRenderer. It is the same as getChecked().
| Output |
|
boolean
| whether the checkbox is checked. |
| Exception |
|
getDataChanged
| public boolean getDataChanged |
() |
Returns a value indicating whether postback has caused the control data change.
This method is required by the IPostBackDataHandler interface.
| Output |
|
boolean
| whether postback has caused the control data change. False if the page is not in postback mode. |
| Exception |
|
getEnableClientScript
| public boolean getEnableClientScript |
() |
| Output |
|
boolean
| whether to render javascript. |
| Exception |
|
getInputAttributes
| public TMap getInputAttributes |
() |
| Output |
|
TMap
| list of attributes to be rendered for the checkbox |
| Exception |
|
getIsValid
| public bool getIsValid |
() |
Returns true if this control validated successfully.
Defaults to true.
| Output |
|
bool
| wether this control validated successfully. |
| Exception |
|
getLabelAttributes
| public TMap getLabelAttributes |
() |
| Output |
|
TMap
| list of attributes to be rendered for label beside the checkbox |
| Exception |
|
getPostBackOptions
| protected array getPostBackOptions |
() |
Gets the post back options for this checkbox.
|
getSpanNeeded
| protected bool getSpanNeeded |
() |
Check if we need a span tag to surround this control. The span tag will be created if the Text property is set for this control.
| Output |
|
bool
| wether this control needs a surrounding span tag |
| Exception |
|
getSurroundingTagID
| public string getSurroundingTagID |
() |
| Output |
|
string
| the id of the surrounding tag or this clientID if no such tag needed |
| Exception |
|
getTagName
| protected string getTagName |
() |
| Output |
|
string
| tag name of the button |
| Exception |
|
getText
| Output |
|
string
| the text caption of the checkbox |
| Exception |
|
getTextAlign
| Output |
|
TTextAlign
| the alignment (Left or Right) of the text caption, defaults to TTextAlign::Right. |
| Exception |
|
getValidationGroup
| public string getValidationGroup |
() |
| Output |
|
string
| the group of validators which the checkbox causes validation upon postback |
| Exception |
|
getValidationPropertyValue
| public mixed getValidationPropertyValue |
() |
Returns the value of the property that needs validation.
| Output |
|
mixed
| the property value to be validated |
| Exception |
|
getValue
| public string getValue |
() |
| Output |
|
string
| the value of the checkbox. Defaults to empty. |
| Exception |
|
getValueAttribute
| protected string getValueAttribute |
() |
| Output |
|
string
| the value attribute to be rendered |
| Exception |
|
loadPostData
| public boolean loadPostData |
(string $key , array $values ) |
Loads user input data.
This method is primarly used by framework developers.
| Input |
| string | $key | the key that can be used to retrieve data from the input data collection |
| array | $values | the input data collection |
| Output |
|
boolean
| whether the data of the control has been changed |
| Exception |
|
onCheckedChanged
Raises OnCheckedChanged event when getChecked changes value during postback.
If you override this method, be sure to call the parent implementation so that the event delegates can be invoked.
| Input |
| TEventParameter | $param | event parameter to be passed to the event handlers |
| Output |
| Exception |
|
onPreRender
| public void onPreRender |
(mixed $param ) |
Registers the checkbox to receive postback data during postback.
This is necessary because a checkbox if unchecked, when postback, does not have direct mapping between post data and the checkbox name. This method overrides the parent implementation and is invoked before render.
| Input |
| mixed | $param | event parameter |
| Output |
| Exception |
|
raisePostDataChangedEvent
| public void raisePostDataChangedEvent |
() |
Raises postdata changed event.
This method raises OnCheckedChanged event. This method is primarly used by framework developers.
|
render
Renders the checkbox control.
This method overrides the parent implementation by rendering a checkbox input element and a span element if needed.
| Input |
| THtmlWriter | $writer | the writer used for the rendering purpose |
| Output |
| Exception |
|
renderClientControlScript
| protected void renderClientControlScript |
(mixed $writer ) |
Renders the client-script code.
| Input |
| mixed | $writer | |
| Output |
| Exception |
|
renderInputTag
| protected void renderInputTag |
(THtmlWriter $writer , string $clientID , string $onclick ) |
Renders a checkbox input element.
| Input |
| THtmlWriter | $writer | the writer for the rendering purpose |
| string | $clientID | checkbox id |
| string | $onclick | onclick js |
| Output |
| Exception |
|
renderLabel
| protected void renderLabel |
(THtmlWriter $writer , string $clientID , string $text ) |
Renders a label beside the checkbox.
| Input |
| THtmlWriter | $writer | the writer for the rendering purpose |
| string | $clientID | checkbox id |
| string | $text | label text |
| Output |
| Exception |
|
setAutoPostBack
| public void setAutoPostBack |
(boolean $value ) |
Sets a value indicating whether clicking on the checkbox will post the page.
| Input |
| boolean | $value | whether clicking on the checkbox will post the page. |
| Output |
| Exception |
|
setCausesValidation
| public void setCausesValidation |
(boolean $value ) |
Sets the value indicating whether postback event trigger by this checkbox will cause input validation.
| Input |
| boolean | $value | whether postback event trigger by this checkbox will cause input validation. |
| Output |
| Exception |
|
setChecked
| public void setChecked |
(boolean $value ) |
Sets a value indicating whether the checkbox is to be checked or not.
| Input |
| boolean | $value | whether the checkbox is to be checked or not. |
| Output |
| Exception |
|
setData
| public void setData |
(boolean $value ) |
Sets the value indicating whether the checkbox is to be checked or not.
This method is required by IDataRenderer. It is the same as setChecked().
| Input |
| boolean | $value | whether the checkbox is to be checked |
| Output |
| Exception |
|
setEnableClientScript
| public void setEnableClientScript |
(boolean $value ) |
| Input |
| boolean | $value | whether to render javascript. |
| Output |
| Exception |
|
setIsValid
| public void setIsValid |
(bool $value ) |
| Input |
| bool | $value | wether this control is valid. |
| Output |
| Exception |
|
setText
| public void setText |
(string $value ) |
Sets the text caption of the checkbox.
| Input |
| string | $value | the text caption to be set |
| Output |
| Exception |
|
setTextAlign
| Input |
| TTextAlign | $value | the alignment of the text caption. Valid values include Left and Right. |
| Output |
| Exception |
|
setValidationGroup
| public void setValidationGroup |
(string $value ) |
| Input |
| string | $value | the group of validators which the checkbox causes validation upon postback |
| Output |
| Exception |
|
setValue
| public void setValue |
(string $value ) |
| Input |
| string | $value | the value of the checkbox |
| Output |
| Exception |
|
|