Disable enable dropdownlistfor based on model property in mvc

前端 未结 3 1444
醉梦人生
醉梦人生 2021-01-27 16:23

I am trying to disable or enable a dropdownlistfor in my mvc application based on model property:-

what I am doing is :-

@Html.DropDownListFor(m => m.         


        
3条回答
  •  渐次进展
    2021-01-27 17:05

    This is an HTML basic rule: from the moment you set the attribute disabled (regardless of its value), the element will be disabled.

    To get what you want, you need to create an HTML extension DropDownListFor.

    Please see this link.

提交回复
热议问题