Share via


HtmlHelperInputExtensions.RadioButton Method

Definition

Overloads

RadioButton(IHtmlHelper, String, Object)

Returns an <input> element of type "radio" for the specified expression. Adds a "value" attribute to the element containing the value parameter if that is non-null. Adds a "checked" attribute to the element if value matches the first non-null value found in: the ModelState entry with full name, the ViewData entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

RadioButton(IHtmlHelper, String, Object, Boolean)

Returns an <input> element of type "radio" for the specified expression. Adds a "value" attribute to the element containing the value parameter if that is non-null. Adds a "checked" attribute to the element if value matches the first non-null value found in: the ModelState entry with full name, the isChecked parameter, the ViewData entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

RadioButton(IHtmlHelper, String, Object, Object)

Returns an <input> element of type "radio" for the specified expression. Adds a "value" attribute to the element containing the first non-null value found in: the value parameter, or the htmlAttributes dictionary entry with key "value". Adds a "checked" attribute to the element if value matches the first non-null value found in: the htmlAttributes dictionary entry with key "checked", the ModelState entry with full name, the ViewData entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

RadioButton(IHtmlHelper, String, Object)

Source:
HtmlHelperInputExtensions.cs
Source:
HtmlHelperInputExtensions.cs
Source:
HtmlHelperInputExtensions.cs

Returns an <input> element of type "radio" for the specified expression. Adds a "value" attribute to the element containing the value parameter if that is non-null. Adds a "checked" attribute to the element if value matches the first non-null value found in: the ModelState entry with full name, the ViewData entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ RadioButton(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper ^ htmlHelper, System::String ^ expression, System::Object ^ value);
public static Microsoft.AspNetCore.Html.IHtmlContent RadioButton (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper, string expression, object value);
static member RadioButton : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper * string * obj -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function RadioButton (htmlHelper As IHtmlHelper, expression As String, value As Object) As IHtmlContent

Parameters

htmlHelper
IHtmlHelper

The IHtmlHelper instance this method extends.

expression
String

Expression name, relative to the current model.

value
Object

Value to include in the element. Must not be null.

Returns

A new IHtmlContent containing the <input> element.

Remarks

Combines HtmlFieldPrefix and expression to set <input> element's "name" attribute. Sanitizes expression to set element's "id" attribute. Sets <input> element's "value" attribute to value.

Applies to

RadioButton(IHtmlHelper, String, Object, Boolean)

Source:
HtmlHelperInputExtensions.cs
Source:
HtmlHelperInputExtensions.cs
Source:
HtmlHelperInputExtensions.cs

Returns an <input> element of type "radio" for the specified expression. Adds a "value" attribute to the element containing the value parameter if that is non-null. Adds a "checked" attribute to the element if value matches the first non-null value found in: the ModelState entry with full name, the isChecked parameter, the ViewData entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ RadioButton(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper ^ htmlHelper, System::String ^ expression, System::Object ^ value, bool isChecked);
public static Microsoft.AspNetCore.Html.IHtmlContent RadioButton (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper, string expression, object value, bool isChecked);
static member RadioButton : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper * string * obj * bool -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function RadioButton (htmlHelper As IHtmlHelper, expression As String, value As Object, isChecked As Boolean) As IHtmlContent

Parameters

htmlHelper
IHtmlHelper

The IHtmlHelper instance this method extends.

expression
String

Expression name, relative to the current model.

value
Object

If non-null, value to include in the element. Must not be null if isChecked is also null.

isChecked
Boolean

If true, radio button is initially selected. Must not be null if value is also null.

Returns

A new IHtmlContent containing the <input> element.

Remarks

Combines HtmlFieldPrefix and expression to set <input> element's "name" attribute. Sanitizes expression to set element's "id" attribute.

Applies to

RadioButton(IHtmlHelper, String, Object, Object)

Source:
HtmlHelperInputExtensions.cs
Source:
HtmlHelperInputExtensions.cs
Source:
HtmlHelperInputExtensions.cs

Returns an <input> element of type "radio" for the specified expression. Adds a "value" attribute to the element containing the first non-null value found in: the value parameter, or the htmlAttributes dictionary entry with key "value". Adds a "checked" attribute to the element if value matches the first non-null value found in: the htmlAttributes dictionary entry with key "checked", the ModelState entry with full name, the ViewData entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ RadioButton(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper ^ htmlHelper, System::String ^ expression, System::Object ^ value, System::Object ^ htmlAttributes);
public static Microsoft.AspNetCore.Html.IHtmlContent RadioButton (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper, string expression, object value, object htmlAttributes);
static member RadioButton : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper * string * obj * obj -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function RadioButton (htmlHelper As IHtmlHelper, expression As String, value As Object, htmlAttributes As Object) As IHtmlContent

Parameters

htmlHelper
IHtmlHelper

The IHtmlHelper instance this method extends.

expression
String

Expression name, relative to the current model.

value
Object

If non-null, value to include in the element. Must not be null if no "checked" entry exists in htmlAttributes.

htmlAttributes
Object

An Object that contains the HTML attributes for the element. Alternatively, an IDictionary<TKey,TValue> instance containing the HTML attributes.

Returns

A new IHtmlContent containing the <input> element.

Remarks

Combines HtmlFieldPrefix and expression to set <input> element's "name" attribute. Sanitizes expression to set element's "id" attribute.

Applies to