I was able to bind data to dropdown when I click on it.
<div>
@Html.DropDownList("DesignDropdown", new List<SelectListItem> { new SelectListItem { Text = "--Select--", Value = "" } })
</div>
Below is JavaScript code in the same page inside <script>
tag
var url = '@Url.Action("GetDesign", "Design")'; // url/api to get data
var ddl = $('#DesignDropdown'); //get ddl instance
$('#DesignDropdown').focus(function () {
$.post(url, {id: designId}, function (response) {
ddl.empty(); //clear if already data there
ddl.append($('<option></option>').text("--Select--").val("")); //first item as --Select--
$.each(response, function (index, item) {
ddl.append($('<option></option>').text(item.Name).val(item.DesignId)); //bind api result to ddl
});
});
$('#DesignDropdown').blur();
})