Reputation: 1
I am using mvc2 with c# ASP.Net. iam trying to implement cascaded dropdownlist, wherein my first dropdown is named group and my second one is build group. so on selecting the group its respective build groups are to be displayed in my 2nd dropdown list..Both the dropdowns should have autocomplete feature. Plz help me to solve the issue.. Thanks and regards
Upvotes: 0
Views: 2012
Reputation: 43
I agree with Adam Terlson. But for other people's reference, I achieved this by setting up the second autocomplete on the autocompleteselect
event of the first, and filtering the JSON array using jQueries grep function. Something like this:
$('.autoCompleteCategory').bind('autocompleteselect', function(event, ui) {
$('.autoCompleteItem').autocomplete({ source: $.grep(items, function(el, i) {return el.sector.toLowerCase() == ui.item.value.toLowerCase();})});
});
Upvotes: 3