jquery - VB.NET: Autocomplete multiple names in textbox inside gridview -
i have added textbox in gridview , need add auto complete in it. have implemented single name cant figure out how add other names within same search
on selection autocomplete should append previous selected name
serch class
<%@ webhandler language="vb" class="search_vb" %> imports system imports system.web imports system.data.sqlclient imports system.configuration imports system.text public class search_vb : implements ihttphandler public sub processrequest(byval context httpcontext) implements ihttphandler.processrequest try dim prefixtext string = context.request.querystring("q") dim prefixarray string() = prefixtext.split(";") dim conn sqlconnection = new sqlconnection conn.connectionstring = configurationmanager _ .connectionstrings("constr").connectionstring dim cmd sqlcommand = new sqlcommand cmd.commandtext = ("select firstname participants " & _ "firstname @searchtext + '%'") cmd.parameters.addwithvalue("@searchtext", prefixarray(prefixarray.length - 1)) cmd.connection = conn dim sb stringbuilder = new stringbuilder conn.open() dim sdr sqldatareader = cmd.executereader while sdr.read sb.append(sdr("firstname")) _ .append(environment.newline) end while conn.close() context.response.write(sb.tostring) catch ex exception end try end sub public readonly property isreusable() boolean implements ihttphandler.isreusable return false end end property end class
javascript
<link href="css/jquery.autocomplete.css" rel="stylesheet" type="text/css" /> <script src="scripts/jquery.autocomplete.js" type="text/javascript"></script> <script type="text/javascript"> function setautocomplete() { var textboxes = document.getelementsbyclassname("autocompletetextbox"); (var = 0; < textboxes.length; i++) { $("#" + textboxes[i].id).autocomplete('search_vb.ashx'); } } </script> <script type="text/javascript"> $(document).ready(function () { setautocomplete(); }); </script>
please me this
Comments
Post a Comment