JS Script Reference
<SCRIPT src = "/scripts/jquery. AutoComplete/jquery. autocomplete. js" type = "text/JavaScript"> </SCRIPT>
Style reference
<Style type = "text/CSS" Media = "all">
@ Import URL ("/scripts/jquery. AutoComplete/CSS/jquery.autocomplete.css ");
</Style>
JSCode
$ (Document). Ready (function () {$ ("# <% = _ searchkeygame. clientid %>"). AutoComplete ("./ajaxhandle/autocomplete. ashx? Type = game ", {minchars: 0, Max: 9, width: 150, matchcontains: True, AutoFill: false, formatitem: function (row, I, max) {return row. name;}, formatmatch: function (row, I, max) {return row. name + "";}, formatresult: function (ROW) {return row. name ;}}); jquery ("# <%= _ searchkeygame. clientid %> "). result (function (event, Data, formatted) {If (data) {jquery ("# _ searchkeygame "). ATTR ("value", Data. Name) ;}else {}}); $ ("# <% = _ searchkeyplat. clientid %>"). AutoComplete ("./ajaxhandle/autocomplete. ashx? Type = plat ", {minchars: 0, Max: 9, width: 150, matchcontains: True, AutoFill: false, formatitem: function (row, I, max) {return row. name;}, formatmatch: function (row, I, max) {return row. name + "";}, formatresult: function (ROW) {return row. name ;}});
AutoComplete. Ashx returns the joson value.
String Querystr = context. Request. querystring [ " Q " ]; Context. response. contenttype = " Text/plain " ; Context. response. cache. setnostore (); String July string = " [ " ; String Where = String . Format ( " (Select DBO. [f_getpy] (platname) like '% {0} %' or platname like '% {0} %' " , Common. Common. tosql (querystr); datatable dt = New Models. Plat (). getdatatable ( Where , 10 ); If (Dt. Rows. Count> 0 ){ For ( Int I = 0 ; I <DT. Rows. Count; I ++ ) {July string + = " {ID :\" " + Dt. Rows [I] [ " Platid " ]. Tostring () + " \ ", Name :\" " + Dt. Rows [I] [ " Platname " ]. Tostring () + " \"}, " ;} J1_string = July string. Trim ( New Char [] { ' , ' }); J1_string + = " ] " ; Context. response. Write (j1_string); context. response. End ();