Share via


HtmlHelper<TModel>.EditorFor<TResult> Method

Definition

Returns HTML markup for the expression, using an editor template, specified HTML field name, and additional view data. The template is found using the templateName or the expression's ModelMetadata.

public:
generic <typename TResult>
 virtual Microsoft::AspNetCore::Html::IHtmlContent ^ EditorFor(System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression, System::String ^ templateName, System::String ^ htmlFieldName, System::Object ^ additionalViewData);
public Microsoft.AspNetCore.Html.IHtmlContent EditorFor<TResult> (System.Linq.Expressions.Expression<Func<TModel,TResult>> expression, string templateName, string htmlFieldName, object additionalViewData);
abstract member EditorFor : System.Linq.Expressions.Expression<Func<'Model, 'Result>> * string * string * obj -> Microsoft.AspNetCore.Html.IHtmlContent
override this.EditorFor : System.Linq.Expressions.Expression<Func<'Model, 'Result>> * string * string * obj -> Microsoft.AspNetCore.Html.IHtmlContent
Public Function EditorFor(Of TResult) (expression As Expression(Of Func(Of TModel, TResult)), templateName As String, htmlFieldName As String, additionalViewData 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.

templateName
String

The name of the template that is used to create the HTML markup.

htmlFieldName
String

A String used to disambiguate the names of HTML elements that are created for properties that have the same name.

additionalViewData
Object

An anonymous Object or IDictionary<TKey,TValue> that can contain additional view data that will be merged into the ViewDataDictionary<TModel> instance created for the template.

Returns

A new IHtmlContent containing the <input> element(s).

Implements

Applies to