效果:
html代码:
<input id ="comb" name ="comb"/>
JS代码:
$(function () {
$('#comb').combobox({
width: ,
valueField: 'id',
textField: 'name',
url:'../Json/comboBoxjson.ashx',
});
})
后台一般处理程序代码:
public void ProcessRequest(HttpContext context)
{
DataTable dt = SQLHelper.ExecuteTable("select id, name from Tb_person", CommandType.Text);
string comboboxjson = DatatableToJson.ToJson(dt);
context.Response.Write(comboboxjson);
}