HtmlHelper.RadioButton Method (String, Object, Boolean, Object)

Returns an HTML radio button control that has the specified name, value, default selected status, and custom attributes defined by an attribute object.

Namespace:  System.Web.WebPages.Html
Assembly:  System.Web.WebPages (in System.Web.WebPages.dll)


Public Function RadioButton ( _
    name As String, _
    value As Object, _
    isChecked As Boolean, _
    htmlAttributes As Object _
) As IHtmlString
Dim instance As HtmlHelper 
Dim name As String 
Dim value As Object 
Dim isChecked As Boolean 
Dim htmlAttributes As Object 
Dim returnValue As IHtmlString 

returnValue = instance.RadioButton(name, _
    value, isChecked, htmlAttributes)
public IHtmlString RadioButton(
    string name,
    Object value,
    bool isChecked,
    Object htmlAttributes
IHtmlString^ RadioButton(
    String^ name, 
    Object^ value, 
    bool isChecked, 
    Object^ htmlAttributes
member RadioButton : 
        name:string * 
        value:Object * 
        isChecked:bool * 
        htmlAttributes:Object -> IHtmlString
public function RadioButton(
    name : String, 
    value : Object, 
    isChecked : boolean, 
    htmlAttributes : Object
) : IHtmlString


  • name
    Type: System.String
    The value to assign to the name attribute of the HTML control element. The name attribute defines the group that the radio button belongs to.
  • value
    Type: System.Object
    The value to assign to the value attribute of the element.
  • isChecked
    Type: System.Boolean
    true to indicate that the control is selected; otherwise, false.
  • htmlAttributes
    Type: System.Object
    An object that contains custom attributes for the element. The attribute names and values are retrieved through reflection by examining the properties of the object.

Return Value

Type: System.Web.IHtmlString
The HTML markup that represents the radio button control.


Exception Condition

name is null reference (Nothing in Visual Basic) or empty.


The returned markup consists of an HTML input element in one of the following forms:

<input type="radio" name="name" value="value" checked="checked" ...htmlAttributes... />

isChecked is true.

<input type="radio" name="name" value="value "...htmlAttributes... />

isChecked is false.

See Also


HtmlHelper Class

RadioButton Overload

System.Web.WebPages.Html Namespace