Auto-complete textbox using Jquery

auto-complete textbox using JQuery

Jquery functions :

$(document).ready(function(){
    FillCity();
});

function FillCity()
{
$(‘#<%=txtCity.ClientId%>’).autocomplete([<%=strCity%>], {
scroll: true,
scrollHeight: 100,
matchContains: true,
selectFirst: true,
matchCase: false,
cacheLength: 50
}).result(function(event, item) {
//alert(item);
});
}

 

server side code :

Public strCity As String = “”

now assign the comma separated list of the city to strCity in the page_load.

this all you have to do for the auto complete TextBox.

Leave a Reply