wwHtmlHelpers.HtmlRadioButton

Creates an HTML Radio Button control.

To create a single radio button that acts like a checkbox you can use the following code:

? HtmlRadioButton("radRed","Color Red",true,"Red")
* <input type="radio" name="radRed" id="radRed" value="Red" checked="checked" /> <label for="radRed">Color Red</label>

? HtmlRadioButton("radBlue","Color Blue",false,"Blue")
* <input type="radio" name="radBlue" id="radBlue" value="Blue" /> <label for="radRed">Color Blue</label>

To create a radio button group use the same name and different values for each button in the group and give a unique id in the attributes.

HtmlRadioButton("radColor","Blue",true,"blue",[ class="radiocolor" id="radColor_1"])
HtmlRadioButton("radColor","Red",false,"red",[ class="radiocolor" id="radColor_2"])
HtmlRadioButton("radColor","Green",false,"red",[ class="radiocolor" id="radColor_3"])
HtmlRadioButton(lcName,lcText, llChecked, lcValue,lcAttribute)

Parameters

lcName
The name of the radio button to create. Creates the name and id tags by default. The id tag can be overridden with the lcAttributes parameter if provided there.

lcText
The text to display with this radio button

llChecked
A logical value that determines whether the control is checked or not.

On a Postback operation llValue is automatically read from Request.Form() if available.

lcValue
The value of the control. Since Radios are multiple choice options each radio has a unique value that gets returned in the POST buffer.

lcAttributes
Optional attributes to assign to the input tag.


See also:

Class wwHtmlHelpers

© West Wind Technologies, 1996-2018 • Updated: 09/03/16
Comment or report problem with topic