Class TRadioButton
Direct Known Sub-classes:
TRadioButton class
TRadioButton displays a radio button on the page. You can specify the caption to display beside the radio buttonby setting the Text property. The caption can appear either on the right or left of the radio button, which is determined by the TextAlign property. To determine whether the TRadioButton component is checked, test the Checked property. The OnCheckedChanged event is raised when the Checked state of the TRadioButton 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 TRadioButton component changes between posts to the server. TRadioButton uses GroupName to group together a set of radio buttons. Once the GroupName is set, you can use the getRadioButtonsInGroup method to get an array of TRadioButtons having the same group name. If AutoPostBack is set true, changing the radio button 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,
|
Constructor Summary |
public |
Constructor.
|
Method Summary |
protected
void
|
Add the group name as post data loader if group name is set.
|
protected
string
|
Gets the name of the javascript class responsible for performing postback for this control.
|
boolean
|
|
string
|
|
array
|
Gets an array of radiobuttons whose group name is the same as this radiobutton's.
|
string
|
|
protected
string
|
|
boolean
|
Loads user input data.
|
void
|
Registers the radio button groupings. If overriding onInit method, ensure to call parent implemenation.
|
void
|
Unregisters the radio button groupings. If overriding onInit method, ensure to call parent implemenation.
|
protected
void
|
Renders the client-script code.
|
protected
void
|
Renders a radiobutton input element.
|
void
|
|
void
|
Sets the name of the group that the radio button belongs to.
|
void
|
Sets the unique group name that the radio button belongs to.
|
Methods Inherited From TCheckBox |
TCheckBox::getAutoPostBack(), TCheckBox::getCausesValidation(), TCheckBox::getChecked(), TCheckBox::getClientClassName(), TCheckBox::getData(), TCheckBox::getDataChanged(), TCheckBox::getEnableClientScript(), TCheckBox::getInputAttributes(), TCheckBox::getIsValid(), TCheckBox::getLabelAttributes(), TCheckBox::getPostBackOptions(), TCheckBox::getSpanNeeded(), TCheckBox::getSurroundingTagID(), TCheckBox::getTagName(), TCheckBox::getText(), TCheckBox::getTextAlign(), TCheckBox::getValidationGroup(), TCheckBox::getValidationPropertyValue(), TCheckBox::getValue(), TCheckBox::getValueAttribute(), TCheckBox::loadPostData(), TCheckBox::onCheckedChanged(), TCheckBox::onPreRender(), TCheckBox::raisePostDataChangedEvent(), TCheckBox::render(), TCheckBox::renderClientControlScript(), TCheckBox::renderInputTag(), TCheckBox::renderLabel(), TCheckBox::setAutoPostBack(), TCheckBox::setCausesValidation(), TCheckBox::setChecked(), TCheckBox::setData(), TCheckBox::setEnableClientScript(), TCheckBox::setIsValid(), TCheckBox::setText(), TCheckBox::setTextAlign(), TCheckBox::setValidationGroup(), TCheckBox::setValue()
|
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()
|
Constructor Details |
__construct
Constructor.
Registers the radiobutton in a global radiobutton collection. If overridden, the parent implementation must be invoked first.
|
Method Details |
addToPostDataLoader
protected void addToPostDataLoader |
() |
Add the group name as post data loader if group name is set.
|
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 |
|
getEnableClientScript
public boolean getEnableClientScript |
() |
Output |
boolean
| whether to render javascript. |
Exception |
|
getGroupName
public string getGroupName |
() |
Output |
string
| the name of the group that the radio button belongs to. Defaults to empty. |
Exception |
|
getRadioButtonsInGroup
public array getRadioButtonsInGroup |
() |
Gets an array of radiobuttons whose group name is the same as this radiobutton's.
Note, only those radiobuttons that are on the current page hierarchy may be returned in the result.
Output |
array
| list of TRadioButton with the same group |
Exception |
|
getUniqueGroupName
public string getUniqueGroupName |
() |
Output |
string
| the name used to fetch radiobutton post data |
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 |
|
onInit
Registers the radio button groupings. If overriding onInit method, ensure to call parent implemenation.
Input |
TEventParameter | $param | event parameter to be passed to the event handlers |
Output |
Exception |
|
onUnLoad
Unregisters the radio button groupings. If overriding onInit method, ensure to call parent implemenation.
Input |
TEventParameter | $param | event parameter to be passed to the event handlers |
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 radiobutton input element.
Input |
THtmlWriter | $writer | the writer for the rendering purpose |
string | $clientID | checkbox id |
string | $onclick | onclick js |
Output |
Exception |
|
setEnableClientScript
public void setEnableClientScript |
(boolean $value ) |
Input |
boolean | $value | whether to render javascript. |
Output |
Exception |
|
setGroupName
public void setGroupName |
(string $value ) |
Sets the name of the group that the radio button belongs to.
The group is unique among the control's naming container.
Input |
string | $value | the group name |
Output |
Exception |
|
setUniqueGroupName
public void setUniqueGroupName |
(string $value ) |
Sets the unique group name that the radio button belongs to.
A unique group is a radiobutton group unique among the whole page hierarchy, while the GroupName specifies a group that is unique among the control's naming container only. For example, each cell of a TDataGrid is a naming container. If you specify GroupName for a radiobutton in a cell, it groups together radiobutton within a cell, but not the other, even though they have the same GroupName. On the contratry, if UniqueGroupName is used instead, it will group all appropriate radio buttons on the whole page hierarchy. Note, when both UniqueGroupName and GroupName, the former takes precedence.
Input |
string | $value | the group name |
Output |
Exception |
|
|