Creating a SelectListItem with the disabled=“disabled” attribute

后端 未结 5 977
感情败类
感情败类 2020-12-05 07:01

I\'m not seeing a way to create, via the HtmlHelper, a SelectListItem that will spit out the following HTML:

5条回答
  •  天涯浪人
    2020-12-05 07:32

    If all you are trying to do is prevent a user from selecting a certain value from the list, it seems like the simpler and more time-efficient way to do it is to use input validation. Which you may quite possibly be doing anyways, if you want to verify they've made a selection to begin with.

提交回复
热议问题