Home >Web Front-end >HTML Tutorial >Set the HTML control in MVC to readonly_html/css_WEB-ITnose
1. Set the drop-down box to read-only and try this one. It works:
@Html.DropDownListFor(model => model.SecondDevelopment, (SelectList)ViewBag.swseconddevelopment, new { disabled = "disabled" })
@Html.TextBoxFor(model => model.ProjectLeaderName, new { @readonly = "readonly" })
3. Multi-select box
@Html.CheckBoxListFor(model => model.ProvideService, (SelectList)ViewBag.swprovideservice,null, new { @readonly = true })
@Html.RadioButtonListFor(model => model.NeedApply, (SelectList)ViewBag.swneedapplyornot, null, new { disabled = "disabled" })