打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
下拉框自动完成(autocomplete)带有分页功能SutaraLumpur

效果图:

SutaraLumpur-jQuery.ajaxComboBox.js简介地址:http://d.hatena.ne.jp/sutara_lumpur/20090124/1232781879

下载地址:https://github.com/SutaraLumpur/jquery.ajaxComboBox.js/zipball/master

html代码:

  1. <input type="text" name="txtZdType" id="txtZdType" autocomplete="off" />  
javascript代码:
[javascript] view plain copy
  1.     <script src="../Scripts/jquery-1.8.3.min.js" type="text/javascript"></script>  
  2.     <link href="../Scripts/acbox/jquery.ajaxComboBox.css" rel="stylesheet" type="text/css" />  
  3.     <script src="../Scripts/acbox/jquery.ajaxComboBox.7.1.js" type="text/javascript"></script>  
  4.     <script type="text/javascript">  
  5.         $(function () {  
  6.             //选择入院诊断Ajax自动完成  
  7.             $('#txtZdType').ajaxComboBox("/WebService/AjaxService.asmx/GetBaicd", { lang: 'en', per_page: 15, field: 'Name', list_field: 'py' });  
  8.         });  
  9.     </script>  
C#  WebService代码:
[csharp] view plain copy
  1.         /// <summary>  
  2.         /// 根据传人的参数,分页的诊断数据  
  3.         /// </summary>  
  4.         /// <param name="page_num">当前页码</param>  
  5.         /// <param name="per_page">每页显示条数</param>  
  6.         [WebMethod]  
  7.         public void GetBaicd(int page_num, int per_page)  
  8.         {  
  9.             //string and_or, string db_table, string[][] order_by, string[][] desc, string[] search_field;  
  10.             HttpRequest Request = HttpContext.Current.Request;  
  11.             string q_word = Request["q_word[]"];  
  12.             ba_icd10BLL bll = new ba_icd10BLL();  
  13.             int count = bll.GetCount();//总条数  
  14.             StringBuilder sb = new StringBuilder();  
  15.             sb.Append("{\"result\":");  
  16.             string strWhere = "";  
  17.             if (!string.IsNullOrWhiteSpace(q_word))  
  18.             {  
  19.                 strWhere = string.Format("where Py like '{0}%' or Name like '{0}%'", q_word);  
  20.             }  
  21.             List<ba_icd10Info> lst = bll.GetPagerList(page_num, per_page, strWhere);  
  22.             if (lst != null && lst.Count > 0)  
  23.             {  
  24.                 JavaScriptSerializer jss = new JavaScriptSerializer();  
  25.                 jss.Serialize(lst, sb);  
  26.             }  
  27.             sb.AppendFormat(",\"cnt_whole\":{0}}}", count);  
  28.             //return sb.ToString();  
  29.             HttpContext.Current.Response.Write(sb.ToString());  
  30.             HttpContext.Current.Response.End();  
  31.         }  

ps:当前项目使用的时候,修改了网上下载的jquery.ajaxComboBox.7.1.js,

改动位置:69,87行,文件路径,1293 匹配正则,1302自动完成匹配字段,1827行赋值到其它文本框。

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
.NET Jquery MsSql实现仿百度输入自动补全
浅析JSONP-解决Ajax跨域访问问题
自定义分页标签
博客园 - 二十四画生的Blog - [DNN学习所得]如何防止页面中的敏感信息被提取
ASP.NET MVC:多语言的三种技术处理策略
play framework学习笔记之 ajax集成使用
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服