Cascading Dropdownlistfor Asp.net Mvc
I have a page with two drop downs (DropDownListFor) that are populated on load. One is a category and the other is the items that fit that category. There is a title (TextAreaFor)
Solution 1:
I have found that by putting calls inside they will be fired sequentially. If they are outside then it will call the database and try to call the update before the database call has finished and will cause issues. Try changing your code like this
categories.change(function () {
requests.find('option').remove();
$.getJSON('_Some_Page', { Category:
$("#BLL_ID>option:selected").val() }, function (data) {
$(data).each(function (index) {
$("<option value=" + this.Value + ">" + this.Text + "
</option>").appendTo(requests);
});
updateTitle(); //move the update here so it is inside the getJSON
});
});
Post a Comment for "Cascading Dropdownlistfor Asp.net Mvc"