HtmlHelperEditorExtensions.EditorFor HtmlHelperEditorExtensions.EditorFor HtmlHelperEditorExtensions.EditorFor Method

Definition

Overloads

EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>)

Returns HTML markup for the expression, using an editor template. The template is found using the expression's ModelMetadata.

EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, Object) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, Object) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, Object)

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

EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String)

Returns HTML markup for the expression, using an editor template. The template is found using the templateName or the expression's ModelMetadata.

EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String, Object) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String, Object) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String, Object)

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

EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String, String) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String, String) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String, String)

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

EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>)

Returns HTML markup for the expression, using an editor template. The template is found using the expression's ModelMetadata.

public static Microsoft.AspNetCore.Html.IHtmlContent EditorFor<TModel,TResult> (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TResult>> expression);
static member EditorFor : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Result>> -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function EditorFor(Of TModel, TResult) (htmlHelper As IHtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TResult))) As IHtmlContent

Type Parameters

TModel

The type of the model.

TResult

The type of the expression result.

Parameters

expression
Expression<Func<TModel,TResult>>

An expression to be evaluated against the current model.

Returns

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

Remarks

For example the default Object editor template includes <label> and <input> elements for each property in the expression result.

Custom templates are found under a EditorTemplates folder. The folder name is case-sensitive on case-sensitive file systems.

EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, Object) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, Object) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, Object)

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

public static Microsoft.AspNetCore.Html.IHtmlContent EditorFor<TModel,TResult> (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TResult>> expression, object additionalViewData);
static member EditorFor : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Result>> * obj -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function EditorFor(Of TModel, TResult) (htmlHelper As IHtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TResult)), additionalViewData As Object) As IHtmlContent

Type Parameters

TModel

The type of the model.

TResult

The type of the expression result.

Parameters

expression
Expression<Func<TModel,TResult>>

An expression to be evaluated against the current model.

additionalViewData
Object Object 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).

Remarks

For example the default Object editor template includes <label> and <input> elements for each property in the expression result.

Custom templates are found under a EditorTemplates folder. The folder name is case-sensitive on case-sensitive file systems.

EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String)

Returns HTML markup for the expression, using an editor template. The template is found using the templateName or the expression's ModelMetadata.

public static Microsoft.AspNetCore.Html.IHtmlContent EditorFor<TModel,TResult> (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TResult>> expression, string templateName);
static member EditorFor : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Result>> * string -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function EditorFor(Of TModel, TResult) (htmlHelper As IHtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TResult)), templateName As String) As IHtmlContent

Type Parameters

TModel

The type of the model.

TResult

The type of the expression result.

Parameters

expression
Expression<Func<TModel,TResult>>

An expression to be evaluated against the current model.

templateName
String String String

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

Returns

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

Remarks

For example the default Object editor template includes <label> and <input> elements for each property in the expression result.

Custom templates are found under a EditorTemplates folder. The folder name is case-sensitive on case-sensitive file systems.

EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String, Object) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String, Object) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String, Object)

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

public static Microsoft.AspNetCore.Html.IHtmlContent EditorFor<TModel,TResult> (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TResult>> expression, string templateName, object additionalViewData);
static member EditorFor : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Result>> * string * obj -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function EditorFor(Of TModel, TResult) (htmlHelper As IHtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TResult)), templateName As String, additionalViewData As Object) As IHtmlContent

Type Parameters

TModel

The type of the model.

TResult

The type of the expression result.

Parameters

expression
Expression<Func<TModel,TResult>>

An expression to be evaluated against the current model.

templateName
String String String

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

additionalViewData
Object Object 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).

Remarks

For example the default Object editor template includes <label> and <input> elements for each property in the expression result.

Custom templates are found under a EditorTemplates folder. The folder name is case-sensitive on case-sensitive file systems.

EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String, String) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String, String) EditorFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, String, String)

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

public static Microsoft.AspNetCore.Html.IHtmlContent EditorFor<TModel,TResult> (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TResult>> expression, string templateName, string htmlFieldName);
static member EditorFor : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Result>> * string * string -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function EditorFor(Of TModel, TResult) (htmlHelper As IHtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TResult)), templateName As String, htmlFieldName As String) As IHtmlContent

Type Parameters

TModel

The type of the model.

TResult

The type of the expression result.

Parameters

expression
Expression<Func<TModel,TResult>>

An expression to be evaluated against the current model.

templateName
String String String

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

htmlFieldName
String String String

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

Returns

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

Remarks

For example the default Object editor template includes <label> and <input> elements for each property in the expression result.

Custom templates are found under a EditorTemplates folder. The folder name is case-sensitive on case-sensitive file systems.

Applies to