In my scenrio dropdown is loading properly with list of records.
When click edit- dropdown want to loaded and set the pre selected or database value want to come first
For me every time dropdown loaded as
"--select--"
one
Two
Three
this is the code
////
$.each(response.CodeValueList, function (data, value) {
if (value.CodeValueId == response.Currentid)// checking pre selected value with list of value
{
$("#ddlid").append($('<option/>', { value: value.CodeValueId, selected: 'selected', html: value.Value }));
}
else {
$("#ddlid").append($('<option/>', { value: value.CodeValueId, html: value.Value }));
}
})
@Html.DropDownList("ddlid", Enumerable.Empty<SelectListItem>(), "---Select---", new { @style = "width: 100%;", @id = "ddlid" })
Note while debugging condition satisfying going to respective section but at last iam getting --select-- only as first item
Please help on this