Reputation: 45
I want to disable the first element "Accreditation" as it is only a label but when it gets selected I get exception. To avoid it it should be disable by-default and after it next first element should get selected
@Html.DropDownListFor(model => model.ReportTemplate.AccreditationId,
Model.lstAccrediation,
"Accreditation",
new { @class = "selectmenu", @id = "ddlAccreditationId",
data_val = "false" })
Upvotes: 0
Views: 273
Reputation: 45
This has resolved the issue and helped in completing the requirement
/* To Disable the first element in drop-down Accreditation */
$("#ddlAccreditationId option[value='0']").attr("disabled", true);
Upvotes: 2