{ //in the Homecontroller public JsonResult AutocompleteSuggestions(string serchtext) { var suggestions = selectEmployees.getEmployeeSuggestedNumbers(serchtext); return Json(suggestions, JsonRequestBehavior.AllowGet); } //searchtext getting Null values from the View <script src="<%: Url.Content("~/Scripts/jquery-1.4.4.min.js")%>" type="text/javascript"></script> <script src="<%: Url.Content("~/Scripts/jquery-ui.min.js")%>" type="text/javascript"></script> //in the index.aspx <h3 class="searchlabel">Search</h3> <form1 runat="server" action = "" method="post"> <input id="searchTerm" name="searchTerm" type="text" /> <script type="text/javascript"> $(function () { $("#searchTerm").autocomplete({ source: "/Home/AutocompleteSuggestions", minLength: 1, select: function (event, ol) { if (ol.item) { $("#searchTerm").val(ol.item.value); $("form1").submit(); } } }); }); </script> <%-- <% Html.RenderPartial("~/Views/Home/Search.ascx"); %> --%>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)