IHtmlHelper.Editor(String, String, String, Object) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
使用編輯器範本、指定的 HTML 功能變數名稱和其他檢視資料,傳回 的 expression HTML 標籤。 您可以使用 或 expression 的 ModelMetadata 找到 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
參數
- templateName
- String
用來建立 HTML 標籤的範本名稱。
- additionalViewData
- Object
匿名 Object 的 ,也可以 IDictionary<TKey,TValue> 包含其他檢視資料,這些資料會合並到 ViewDataDictionary<TModel> 為範本建立的實例中。
傳回
新的 IHtmlContent , < 包含輸入 > 元素 (s) 。
備註
例如,預設 Object 編輯器範本包含 < 值中每個屬性的 expression 標籤 > 和 < 輸入 > 元素。
範例 expression 包括 string.Empty 可識別目前模型,以及 "prop" 識別目前模型的 「prop」 屬性。
自訂範本位於資料夾底下 EditorTemplates 。 資料夾名稱在區分大小寫的檔案系統上會區分大小寫。