Share via


HtmlHelperEditorExtensions.EditorFor Method

Definition

Overloads

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)

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)

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)

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)

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

Source:
HtmlHelperEditorExtensions.cs
Source:
HtmlHelperEditorExtensions.cs
Source:
HtmlHelperEditorExtensions.cs

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

public:
generic <typename TModel, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ EditorFor(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper<TModel> ^ htmlHelper, System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression);
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

htmlHelper
IHtmlHelper<TModel>

The IHtmlHelper<TModel> instance this method extends.

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.

Applies to

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

Source:
HtmlHelperEditorExtensions.cs
Source:
HtmlHelperEditorExtensions.cs
Source:
HtmlHelperEditorExtensions.cs

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:
generic <typename TModel, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ EditorFor(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper<TModel> ^ htmlHelper, System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression, System::Object ^ additionalViewData);
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

htmlHelper
IHtmlHelper<TModel>

The IHtmlHelper<TModel> instance this method extends.

expression
Expression<Func<TModel,TResult>>

An expression to be evaluated against the current model.

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

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

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

Source:
HtmlHelperEditorExtensions.cs
Source:
HtmlHelperEditorExtensions.cs
Source:
HtmlHelperEditorExtensions.cs

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

public:
generic <typename TModel, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ EditorFor(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper<TModel> ^ htmlHelper, System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression, System::String ^ templateName);
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

htmlHelper
IHtmlHelper<TModel>

The IHtmlHelper<TModel> instance this method extends.

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.

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

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

Source:
HtmlHelperEditorExtensions.cs
Source:
HtmlHelperEditorExtensions.cs
Source:
HtmlHelperEditorExtensions.cs

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:
generic <typename TModel, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ EditorFor(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper<TModel> ^ htmlHelper, System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression, System::String ^ templateName, System::Object ^ additionalViewData);
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

htmlHelper
IHtmlHelper<TModel>

The IHtmlHelper<TModel> instance this method extends.

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.

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

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

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

Source:
HtmlHelperEditorExtensions.cs
Source:
HtmlHelperEditorExtensions.cs
Source:
HtmlHelperEditorExtensions.cs

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:
generic <typename TModel, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static Microsoft::AspNetCore::Html::IHtmlContent ^ EditorFor(Microsoft::AspNetCore::Mvc::Rendering::IHtmlHelper<TModel> ^ htmlHelper, System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression, System::String ^ templateName, System::String ^ htmlFieldName);
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

htmlHelper
IHtmlHelper<TModel>

The IHtmlHelper<TModel> instance this method extends.

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.

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