Reputation: 1476
I need to develop a autocomplete textbox customcontrol. Please any ideas or sample code. I need to fetch data from database to populate this control
Upvotes: 0
Views: 648
Reputation: 65
Have a look at the AutoComplete control in the AjaxControlToolkit.
Upvotes: 0
Reputation: 32568
I use the autocomplete plugin for jquery, as I shy away from the AJAX toolkit in most cases. Easy to use remote sources - see the demos from the plugin page.
$("#someTextBoxId").autocomplete({
source: function(request, response) {
$.ajax({
url: "SomeWebService.asmx/GetNames",
data: "{ 'part': '" + request.term + "' }",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
dataFilter: function(data) { return data; },
success: function(data) {
response($.map(data.d, function(item) {
return {
value: item.SomeFieldFromYourJSON
}
}))
}
});
},
minLength: 2
});
Upvotes: 1
Reputation: 158289
Do you need to develop one, or do you need to use one? If using it is the imortant part perhaps the AutoComplete sample at the asp.net Ajax site might help you.
Upvotes: 4