HtmlHelper<TModel>.RadioButtonFor<TResult> 方法

定義

<傳回指定 expression 之 類型為 「radio」 的輸入 > 專案。 將 「value」 屬性加入至包含 中第一個非 null 值的專案: value 參數,或 htmlAttributes 索引鍵 「value」 的字典專案。 如果 value 符合 中找到的第一個非 null 值,請將 「checked」 屬性加入元素: htmlAttributes 索引鍵為 「checked」 的字典專案,或具有完整名稱的專案 ModelState 。 如果 expression 評估為非值,請改用 中找到的第一個非 nullnull 值: ModelState 具有完整名稱的專案,或 expression 針對 評估的專案 Model 。 如需有關「完整名稱」的詳細資訊,請參閱 NameFor<TResult>(Expression<Func<TModel,TResult>>) 。 將 「value」 屬性加入至包含 參數的專案 value

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

類型參數

TResult

結果的類型 expression

參數

expression
Expression<Func<TModel,TResult>>

要針對目前模型評估的運算式。

value
Object

要包含在 專案中的值。 必須不是 null

htmlAttributes
Object

Object,包含 專案的 HTML 屬性。 或者,包含 IDictionary<TKey,TValue> HTML 屬性的實例。

傳回

新的 IHtmlContent ,其中包含 < 輸入 > 專案。

實作

適用於