<div style="float: left"> States Filter : </div> <div style="float: left; padding-removed 10px"> @Html.TextBox("Statestxt") @Html.TextBox("Citiestxt") </div> <div style="padding-removed 10px; float: left"> <input type="image" value="submit" src="../../Images/FilterBrowse.gif" alt="submit Button" /> </div> <script type="text/javascript"> $(document).ready(function () { $("#Statestxt").autocomplete({ source: '@Url.Action("AutocompleteAsync")'}); $("#Citiestxt").autocomplete({ source: '@Url.Action("AutocompleteCity")' }); }); </script>
[NoCache] public ActionResult AutocompleteAsync(string term) { var suggestions = from s in Adm.states select s.state_name; var namelist = suggestions.Where(n => n.ToLower().StartsWith(term.ToLower())); return Json(namelist, JsonRequestBehavior.AllowGet); } [NoCache] public ActionResult AutocompleteCity(string term) { var suggestions = from s in Adm.cities select s.city_name; var namelist = suggestions.Where(n => n.ToLower().StartsWith(term.ToLower())); return Json(namelist, JsonRequestBehavior.AllowGet); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)