I have a SelectList
that populates / works ok.
I have a new Requirement to disable the list for certain users. So I added in a new property to the ViewModel
, LockSelectList
. this property is set in the controller (and works).
However, when the list is rendered, it is always disabled.
I have tried
@Html.DropDownListFor(x => x.Id, Model.AllLocations, new {disabled = Model.LockLocationList? "true" : "false" })
@Html.DropDownListFor(x => x.Id, Model.AllLocations, new {disabled = Model.LockLocationList? "disabled" : "false" })
@Html.DropDownListFor(x => x.Id, Model.AllLocations, new {disabled = Model.LockLocationList? "disabled" : "" })
but none work. they all render correct html, but it seems that the presence of the disabled attribute, no matter the value disables the list. So what do I tweak to the code make this work? (Preferably without using jQuery to handle the enable / disable after the event)