I am trying to disable a dropdownlist based on a condition, I'm using:
var disabledAttr = exists ? "disabled=true" : ""; //exists is a boolean of course
@Html.DropDownListFor(x => x.Input.Divisions[index].DivisionPlayers[participantIndex].Team[playerIndex].Id,
new SelectList(Model.ParticipantsList, "Value", "Text", selected),
new { @class = "participant form-control", disabledAttr })
but the select box renders the attribute as:
disabledattr="disabled=true"
How can I get it to render as simply 'disabled=true'?