效果圖:
SutaraLumpur-jQuery.ajaxComboBox.js簡(jiǎn)介地址:http://d.hatena.ne.jp/sutara_lumpur/20090124/1232781879
下載地址:https://github.com/SutaraLumpur/jquery.ajaxComboBox.js/zipball/master
html代碼:
- <input type="text" name="txtZdType" id="txtZdType" autocomplete="off" />
javascript代碼:- <script src="../Scripts/jquery-1.8.3.min.js" type="text/javascript"></script>
- <link href="../Scripts/acbox/jquery.ajaxComboBox.css" rel="stylesheet" type="text/css" />
- <script src="../Scripts/acbox/jquery.ajaxComboBox.7.1.js" type="text/javascript"></script>
- <script type="text/javascript">
- $(function () {
- //選擇入院診斷Ajax自動(dòng)完成
- $('#txtZdType').ajaxComboBox("/WebService/AjaxService.asmx/GetBaicd", { lang: 'en', per_page: 15, field: 'Name', list_field: 'py' });
- });
- </script>
C# WebService代碼:- /// <summary>
- /// 根據(jù)傳人的參數(shù),分頁(yè)的診斷數(shù)據(jù)
- /// </summary>
- /// <param name="page_num">當(dāng)前頁(yè)碼</param>
- /// <param name="per_page">每頁(yè)顯示條數(shù)</param>
- [WebMethod]
- public void GetBaicd(int page_num, int per_page)
- {
- //string and_or, string db_table, string[][] order_by, string[][] desc, string[] search_field;
- HttpRequest Request = HttpContext.Current.Request;
- string q_word = Request["q_word[]"];
- ba_icd10BLL bll = new ba_icd10BLL();
- int count = bll.GetCount();//總條數(shù)
- StringBuilder sb = new StringBuilder();
- sb.Append("{\"result\":");
- string strWhere = "";
- if (!string.IsNullOrWhiteSpace(q_word))
- {
- strWhere = string.Format("where Py like '{0}%' or Name like '{0}%'", q_word);
- }
- List<ba_icd10Info> lst = bll.GetPagerList(page_num, per_page, strWhere);
- if (lst != null && lst.Count > 0)
- {
- JavaScriptSerializer jss = new JavaScriptSerializer();
- jss.Serialize(lst, sb);
- }
- sb.AppendFormat(",\"cnt_whole\":{0}}}", count);
- //return sb.ToString();
- HttpContext.Current.Response.Write(sb.ToString());
- HttpContext.Current.Response.End();
- }
ps:當(dāng)前項(xiàng)目使用的時(shí)候,修改了網(wǎng)上下載的jquery.ajaxComboBox.7.1.js,
改動(dòng)位置:69,87行,文件路徑,1293 匹配正則,1302自動(dòng)完成匹配字段,1827行賦值到其它文本框。
本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶(hù)發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)
點(diǎn)擊舉報(bào)。