Udostępnij za pośrednictwem


EditorExtensions.Editor Method

Include Protected Members
Include Inherited Members

Returns an HTML input element for each property in the object that is represented by the expression.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

Overload List

  Name Description
Public methodStatic member Editor(HtmlHelper, String) Returns an HTML input element for each property in the object that is represented by the expression.
Public methodStatic member Editor(HtmlHelper, String, Object) Returns an HTML input element for each property in the object that is represented by the expression, using additional view data.
Public methodStatic member Editor(HtmlHelper, String, String) Returns an HTML input element for each property in the object that is represented by the expression, using the specified template.
Public methodStatic member Editor(HtmlHelper, String, String, Object) Returns an HTML input element for each property in the object that is represented by the expression, using the specified template and additional view data.
Public methodStatic member Editor(HtmlHelper, String, String, String) Returns an HTML input element for each property in the object that is represented by the expression, using the specified template and HTML field name.
Public methodStatic member Editor(HtmlHelper, String, String, String, Object) Returns an HTML input element for each property in the object that is represented by the expression, using the specified template, HTML field name, and additional view data.

Top

Remarks

This method generates different HTML markup depending on the data type of the property that is being rendered, and according to whether the property is marked with certain attributes. The method renders markup according to the following rules:

  • If the property is typed as a primitive type (integer, string, and so on), the method renders an HTML input element for a text box. For example, a property named Height that is typed as a integer might render markup such as the following:

    <input class="text-box single-line"

    id="Height"

    name="Height"

    type="text"

    value="68"

    />

  • If a property is marked with a data-type attribute or a UIHintAttribute attribute, the attribute specifies the markup that is generated for the property. For example, if the property is marked with the MultilineText attribute, the method generates markup for a multi-line text box.

  • If the object contains multiple properties, for each property, the method generates a string that consists of markup for the property name and an input element to edit the property value.

See Also

Reference

EditorExtensions Class

System.Web.Mvc.Html Namespace