Metodo EditorExtensions.Editor (HtmlHelper, String) (System.Web.Mvc.Html)

Cambia visualizzazione:
ScriptFree
Riferimento a .NET Framework
Metodo EditorExtensions.Editor (HtmlHelper, String)
Il presente articolo è stato tradotto manualmente. Per visualizzare questa pagina e contemporaneamente visualizzarne il contenuto in lingua inglese, passare alla visualizzazione semplificata.

Restituisce un elemento HTML input per ogni proprietà nell'oggetto rappresentato dall'espressione.

Spazio dei nomi:  System.Web.Mvc.Html
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)
Sintassi

Visual Basic - (Dichiarazione)
<ExtensionAttribute> _
Public Shared Function Editor ( _
	html As HtmlHelper, _
	expression As String _
) As MvcHtmlString
Visual Basic (Utilizzo)
Dim html As HtmlHelper
Dim expression As String
Dim returnValue As MvcHtmlString

returnValue = html.Editor(expression)
C#
public static MvcHtmlString Editor(
	this HtmlHelper html,
	string expression
)
Visual C++
[ExtensionAttribute]
public:
static MvcHtmlString^ Editor(
	HtmlHelper^ html, 
	String^ expression
)
JScript
public static function Editor(
	html : HtmlHelper, 
	expression : String
) : MvcHtmlString

Parametri

html
Tipo: System.Web.Mvc.HtmlHelper
Istanza dell'helper HTML estesa da questo metodo.
expression
Tipo: System.String
Espressione che identifica l'oggetto contenente le proprietà da visualizzare.

Valore restituito

Tipo: System.Web.Mvc.MvcHtmlString
Elemento HTML input per ogni proprietà nell'oggetto rappresentato dall'espressione.

Nota sull'utilizzo

In Visual Basic e C# è possibile chiamare questo metodo come metodo di istanza in qualsiasi oggetto di tipo HtmlHelper. Per chiamare il metodo utilizzando la sintassi del metodo di istanza, omettere il primo parametro. Per ulteriori informazioni, vedere b8020aae-374d-46a9-bcb7-8cc2390b93b6 o 175ce3ff-9bbf-4e64-8421-faeb81a0bb51.
Note

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.

Esempi

A Visual Studio project with source code is available to accompany this topic: Download.

Vedere anche

Riferimenti