ajax自动搜索功能
2011-06-01 16:00
120 查看
页面: <asp:TextBox ID="txt_place" runat="server" class="inputkprice"></asp:TextBox> <cc1:AutoCompleteExtender ID="txt_place_AutoCompleteExtender" runat="server" DelimiterCharacters="" ServicePath="" ServiceMethod="GetCarCompletionList" UseContextKey="True" MinimumPrefixLength="1" TargetControlID="txt_place"> </cc1:AutoCompleteExtender> 后台: [System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()] public static string[] GetCarCompletionList(string prefixText, int count, string contextKey) { ObjModelDataSource<CAR_加油卡> obj = new ObjModelDataSource<CAR_加油卡>(CAR_加油卡.DBNAME, count, CAR_加油卡.COL_办卡地点 + " like '%" + prefixText + "%'"); string[] str = null; if (obj != null && obj.Count > 0)//obj.DataObjectSource.Tables[0].Rows.Count=obj.Count(但是obj.Count会有问题) { str = new string[obj.GetCount()]; int nN = 0; foreach (CAR_加油卡 item in obj) { str[nN] = item.办卡地点; nN++; } } return str; } /// <summary> /// 司机姓名查询 /// </summary> [System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()] public static string[] GetDriverName(string prefixText, int count, string contextKey) { ObjModelDataSource<CAR_司机资料> obj = new ObjModelDataSource<CAR_司机资料>(CAR_司机资料.DBNAME, count, "司机姓名 like '%" + prefixText + "%'"); string[] str = null; if (obj != null && obj.DataObjectSource.Tables[0].Rows.Count > 0) { str = new string[obj.DataObjectSource.Tables[0].Rows.Count]; int nN = 0; foreach (CAR_司机资料 item in obj) { str[nN] = item.司机姓名; nN++; } } return str; }
相关文章推荐
- ajax的搜索功能,回车后页面自动刷新
- [转] 利用AJAX实现搜索提示功能 (关键字自动匹配功能)
- jQuery(Ajax)/PHP/MySQL实现搜索自动提示功能
- jQuery(Ajax)/PHP/MySQL实现搜索自动提示功能
- ajax实现搜索关键词自动完成功能
- Ajax实现搜索栏中输入时的自动提示功能
- JQuery+ajax实现类似百度搜索自动匹配功能
- JQuery+ajax实现类似百度搜索自动匹配功能
- ajax实现搜索提示功能 (关键字自动匹配功能)
- Ajax实现仿Google自动补全功能
- ajax仿thinkphp官网搜索功能
- ajax技术制作得在线歌词搜索功能
- 使用AutoCompleteTextView和SharePreference实现搜索历史自动提示功能
- php+ajax做搜索下拉自动提示框
- 利用redis完成自动补全搜索功能(三)
- 基于jquery实现的类似百度搜索的输入框自动完成功能
- Jquery插件仿百度搜索关键字自动匹配功能
- Ajax树形结构;Ajax自动完成功能,最近Ajax学习的成果
- DevExpress.LookUpEdit控件实现自动搜索定位功能 兼使用方法(looUpEdit可编辑)
- DevExpress.LookUpEdit控件实现自动搜索定位功能