MVC中HTML控件設爲只讀readonly

1.下拉框設爲只讀試了試用這個有效:

  @Html.DropDownListFor(model => model.SecondDevelopment, (SelectList)ViewBag.swseconddevelopment, new { disabled = "disabled" })

2.文本框:
 @Html.TextBoxFor(model => model.ProjectLeaderName, new { @readonly = "readonly" })

3.多選框

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

4.單選按鈕

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


發佈了31 篇原創文章 · 獲贊 3 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章