我用下面的方法來創建表單控件:ASPNET剃刀editorfor有條件地添加屬性
@Html.DropDownList("FK_CompID", null, htmlAttributes: new { @class = "form-control", @readonly = "readonly"})
但是當我需要使它有條件無論是隻讀還是不肯,我就刪除屬性,
有什麼辦法來處理這樣的:
@Html.DropDownList("FK_CompID", null, htmlAttributes: new { @class = "form-control", @readonly = null})
,應不會添加到元素?
你需要向我們展示什麼是確定條件的屬性 –