我填写了下拉列表: 控制器:
var db = new TransFormezEntities()
ViewBag.fldCountry_ID = new SelectList(db.tblCountries, "fldCountry_ID",
"fldCountryName", stateDetails.fldCountry_ID)
查看
国家<div class="display-field" id = "fldCountry_ID">
@Html.DropDownList("fldCountry_ID", "[Select]")
</div>
我想让它成为只读或禁用我怎么能取悦?
答案 0 :(得分:0)
尝试以下代码段
禁用
Html.DropDownList("fldCountry_ID", ViewBag.fldCountry_ID ,
new { @disabled = "disabled" })
只读
Html.DropDownList("fldCountry_ID", ViewBag.fldCountry_ID ,
new { @readonly = "true" })