Home >Web Front-end >HTML Tutorial >Set the HTML control in MVC to readonly_html/css_WEB-ITnose

Set the HTML control in MVC to readonly_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:50:001217browse

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" })

2. Text box:
 @Html.TextBoxFor(model => model.ProjectLeaderName, new { @readonly = "readonly" })

3. Multi-select box

 @Html.CheckBoxListFor(model => model.ProvideService, (SelectList)ViewBag.swprovideservice,null, new { @readonly = true })

4. Radio button

  @Html.RadioButtonListFor(model => model.NeedApply, (SelectList)ViewBag.swneedapplyornot, null, new { disabled = "disabled" })


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn