HtmlHelper<TModel>.RadioButtonFor<TResult> Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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", or
the ModelState entry with full name.
If expression
evaluates to a non-null
value, instead uses the first
non-null
value found in:
the ModelState entry with full name, or
the expression
evaluated against Model.
See NameFor<TResult>(Expression<Func<TModel,TResult>>) for more information about a "full name".
Adds a "value" attribute to the element containing the value
parameter.
public:
generic <typename TResult>
virtual Microsoft::AspNetCore::Html::IHtmlContent ^ RadioButtonFor(System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression, System::Object ^ value, System::Object ^ htmlAttributes);
public Microsoft.AspNetCore.Html.IHtmlContent RadioButtonFor<TResult> (System.Linq.Expressions.Expression<Func<TModel,TResult>> expression, object value, object htmlAttributes);
abstract member RadioButtonFor : System.Linq.Expressions.Expression<Func<'Model, 'Result>> * obj * obj -> Microsoft.AspNetCore.Html.IHtmlContent
override this.RadioButtonFor : System.Linq.Expressions.Expression<Func<'Model, 'Result>> * obj * obj -> Microsoft.AspNetCore.Html.IHtmlContent
Public Function RadioButtonFor(Of TResult) (expression As Expression(Of Func(Of TModel, TResult)), value As Object, htmlAttributes As Object) As IHtmlContent
Type Parameters
- TResult
The type of the expression
result.
Parameters
- expression
- Expression<Func<TModel,TResult>>
An expression to be evaluated against the current model.
- value
- Object
Value to include in the element. Must not be null
.
- 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.