效果:
html代码:
<input id ="comb" name ="comb"/>
JS代码:
$(function () { $(‘#comb‘).combobox({ width: 100, 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); }
时间: 2024-10-12 15:41:06