如何在Asptokeninput中使用Jason [英] How Can I Use Jason In Asptokeninput

查看:106
本文介绍了如何在Asptokeninput中使用Jason的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此代码从数据库中输入用户名:



// javaScript

i use this code to bring user's names from database :

//javaScript

function OnUserChange(s, e) {
$(s.GetInputElement()).autocomplete({
source: function (request, response) {
$.ajax({
type: 'POST',
contentType: "application/json; charset=utf-8",
url: global.path + '/Mail/NewMail.aspx/GetUsers',
data: "{'keyword':'" + request.term + "'}",
dataType: "json",
async: false,
success: function (data) {
data = jQuery.parseJSON(data.d);
response($.map(data, function (item) {
return {
label: item.FullName,
value: item.FullName,
id: item.UserID
}
}))
}
});
}
});
}





//让用户在auotocomplete文本框中使用它



//get user to use it in auotocomplete textbox

  [WebMethod]
   public static string GetUsers(string keyword)
   {
       User user = new User();
       string jsonData = JsonConvert.SerializeObject(user.GetAllUsers(keyword));
return jsonData;
}







如何将此函数传递给asptokeninput控件得到多个自动完成值

请帮帮我




how can i pass this function to asptokeninput control to get multiple autocomplete values
please help me

推荐答案

(s.GetInputElement())。autocomplete({
source:< span class =code-keyword> function (request,response){
(s.GetInputElement()).autocomplete({ source: function (request, response) {


.ajax({
type:' POST'
contentType: application / json; charset = utf-8
url:global.path + ' / Mail / NewMail.aspx / GetUsers'
data: { 'keyword':' + request.term + '}
dataType: json
async: false
成功: function (data){
data = jQuery.parseJSON(data.d);
response(
.ajax({ type: 'POST', contentType: "application/json; charset=utf-8", url: global.path + '/Mail/NewMail.aspx/GetUsers', data: "{'keyword':'" + request.term + "'}", dataType: "json", async: false, success: function (data) { data = jQuery.parseJSON(data.d); response(


.map(data, function (item){
return {
label:item.FullName,
value:item.FullName,
id:item.UserID
}
} ))
}
});
}
});
}
.map(data, function (item) { return { label: item.FullName, value: item.FullName, id: item.UserID } })) } }); } }); }





//让用户在auotocomplete文本框中使用它



//get user to use it in auotocomplete textbox

  [WebMethod]
   public static string GetUsers(string keyword)
   {
       User user = new User();
       string jsonData = JsonConvert.SerializeObject(user.GetAllUsers(keyword));
return jsonData;
}







如何将此函数传递给asptokeninput控件获得多个自动完成值

请帮助我




how can i pass this function to asptokeninput control to get multiple autocomplete values
please help me


这篇关于如何在Asptokeninput中使用Jason的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆