I am doing and MVC Application and I have a DropDownListFor and I need to Disable an Item depend on Condition..
Here is my DropDownList
@Html.DropDownListFor(model => Model.SubsidyPlanType, new SelectList(new Dictionary<string, string> { { "", "" }, { "1", "Dollar" }, { "2", "Percentage" }, { "3", "Active" } }, "Key", "Value"), new { id = "Type", @class = "form-control form-select" })
I need Option 3 "Active" to be disable if condition Model.Value = "1"
How can I disable a single Item.?
Thanks
Try the following example to set
Disabledproperty that indicates whether thisSelectListItemis disabled: