我以前成功使用过它-
http://www.dotnetcurry.com/ShowArticle.aspx?ID=515
我只是稍微修改了一下脚本,如下——
$(function() {
$(".tb").autocomplete({
source: function(request, response) {
$.ajax({
url: "EmployeeList.asmx/FetchEmailList",
data: "{ 'mail': '" + 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 {
Cost: item.Cost //***
}
}))
},
select: function( event, ui ) {
$find("<%= RadTextBox1.ClientID %>").set_value(ui.item.Cost); //***
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
},
minLength: 2
});
});
我用 //* * * 标记了感兴趣的行