title: Issue with autocomplete textbox using jquery in asp.net mvc
body: <p>I need to create an autocomplete textbox to populate customer names in an ASP.Net MVC application. The jQuery code in my view is as follows:</p>
  
  <pre><code>$(document).ready(function() {
      $("input#bldCustomerName").autocomplete({
          source: '&lt;%= Url.Action("ListCustomers","Build") %&gt;'
      });
  });
  </code></pre>
  
  <p>My controller action is:</p>
  
  <pre><code>public ActionResult ListCustomers(string term)
      {
          IList&lt;HSTrader&gt; lstTraders = new List&lt;HSTrader&gt;();
          Build objBld = new Build();
          string trdrType = Resources.Resource.TraderTypeCustomer;
          int trdrTypeId = objBld.GetTraderTypeByTraderTypeName(trdrType).Id;
          lstTraders = objBld.GetTradersByTraderType(trdrTypeId);
  
          var results = from m in lstTraders
                        where m.TraderName.StartsWith(term)
                        select m.TraderName; //new { label = m.TraderName, id = m.Id };
  
          return Json(results.ToArray(), JsonRequestBehavior.AllowGet);
      }
  </code></pre>
  
  <p>On <code>keypress</code> the controller action is executed, but the list doesn't appear under the textbox. What is wrong with my implementation?</p>