0
我想在表單中禁用HTML id,因爲我在一個頁面上使用多個Ajax表單。 目前,我正在做這樣的:全局添加htmlAttributes到EditorFor MVC5
@Html.EditorFor(model => model.AccountNumber, new { htmlAttributes = new { @class = "form-control", id="" } })
但我覺得必須有一個方式在全球範圍內聲明它,就像在一個自定義視圖引擎配置。我不喜歡在每個編輯器上都這麼做,而且我不喜歡爲像UkadcHtmlAttributeProvider這樣的每種數據類型創建編輯模板。
謝謝,去試試。試圖做一個自定義的EditorFor,但沒有嘗試包裝現有的。 – Jogai