HtmlHelperInputExtensions.RadioButton HtmlHelperInputExtensions.RadioButton HtmlHelperInputExtensions.RadioButton Method

Definition

Overloads

RadioButton(IHtmlHelper, String, Object) RadioButton(IHtmlHelper, String, Object) 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) RadioButton(IHtmlHelper, String, Object, Boolean) 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) RadioButton(IHtmlHelper, String, Object, Object) 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) RadioButton(IHtmlHelper, String, Object) 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".

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 IHtmlHelper IHtmlHelper

The IHtmlHelper instance this method extends.

expression
String String String

Expression name, relative to the current model.

value
Object Object 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.

RadioButton(IHtmlHelper, String, Object, Boolean) RadioButton(IHtmlHelper, String, Object, Boolean) 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".

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 IHtmlHelper IHtmlHelper

The IHtmlHelper instance this method extends.

expression
String String String

Expression name, relative to the current model.

value
Object Object Object

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

isChecked
Boolean Boolean 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.

RadioButton(IHtmlHelper, String, Object, Object) RadioButton(IHtmlHelper, String, Object, Object) 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".

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 IHtmlHelper IHtmlHelper

The IHtmlHelper instance this method extends.

expression
String String String

Expression name, relative to the current model.

value
Object Object Object

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

htmlAttributes
Object Object 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