IHtmlHelper.Editor(String, String, String, Object) IHtmlHelper.Editor(String, String, String, Object) IHtmlHelper.Editor(String, String, String, Object) Method


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 Microsoft.AspNetCore.Html.IHtmlContent Editor (string expression, string templateName, string htmlFieldName, object additionalViewData);
abstract member Editor : string * string * string * obj -> Microsoft.AspNetCore.Html.IHtmlContent
Public Function Editor (expression As String, templateName As String, htmlFieldName As String, additionalViewData As Object) As IHtmlContent


String String String

Expression name, relative to the current model. May identify a single property or an Object that contains the properties to edit.

String String String

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

String String String

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

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.


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


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

Example expressions include string.Empty which identifies the current model and "prop" which identifies the current model's "prop" property.

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

Applies to