IHtmlHelper.Editor(String, String, String, Object) 方法

定義

使用編輯器範本、指定的 HTML 功能變數名稱和其他檢視資料,傳回 的 expression HTML 標籤。 您可以使用 或 expressionModelMetadata 找到 templateName 範本。

public:
 Microsoft::AspNetCore::Html::IHtmlContent ^ Editor(System::String ^ expression, System::String ^ templateName, System::String ^ htmlFieldName, System::Object ^ additionalViewData);
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

參數

expression
String

相對於目前模型的運算式名稱。 可以識別包含要編輯之屬性的單一屬性或 Object

templateName
String

用來建立 HTML 標籤的範本名稱。

htmlFieldName
String

String 用來厘清為具有相同名稱之屬性所建立的 HTML 專案名稱。

additionalViewData
Object

匿名 Object 的 ,也可以 IDictionary<TKey,TValue> 包含其他檢視資料,這些資料會合並到 ViewDataDictionary<TModel> 為範本建立的實例中。

傳回

新的 IHtmlContent , < 包含輸入 > 元素 (s) 。

備註

例如,預設 Object 編輯器範本包含 < 值中每個屬性的 expression 標籤 > 和 < 輸入 > 元素。

範例 expression 包括 string.Empty 可識別目前模型,以及 "prop" 識別目前模型的 「prop」 屬性。

自訂範本位於資料夾底下 EditorTemplates 。 資料夾名稱在區分大小寫的檔案系統上會區分大小寫。

適用於