我用下面的方法来创建表单控件: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})
,应不会添加到元素?
你需要向我们展示什么是确定条件的属性 –