title: Autocomplete display data based on value in dropdownlist
body: <p>Does anyone know how, or have any links on how to filter the data returned in a textbox that is based on the value of the selected item in a dropdownlist.</p>
  
  <p>i.e If a user selects hotel from a list, then when they start typing in the textbox only the address of the companies whos category matches hotel will appear using autocomplete.</p>
  
  <hr>
  
  <p>I have added my server side code below, but I'm getting the following error.</p>
  
  <pre><code>public JsonResult FilterDirectorySearch(string searchText, string context)
          {
          var wq = DirectoryList(searchText,context).Select(a =&gt;
             new { Location = a.strLocationSearch });
          return Json(wq.Distinct(), JsonRequestBehavior.AllowGet);
          }
  
      private List&lt;DisplayDirectoryDataForSearchBox&gt; DirectoryList(string searchString, string context)
          {
          var wq = _IGTDD.DisplayDirectoryData()
                    .Where(a =&gt; a.strLocationSearch.Contains(searchString, StringComparison.OrdinalIgnoreCase) &amp;&amp; a.strCategory = context).ToList();
          return wq.ToList();
          }
  </code></pre>
  
  <p>Errors
  Error   1   Instance argument: cannot convert from 'string' to 'System.Linq.IQueryable'</p>
  
  <p>Error   2   'string' does not contain a definition for 'Contains' and the best extension method overload 'System.Linq.Queryable.Contains(System.Linq.IQueryable, TSource, System.Collections.Generic.IEqualityComparer)' has some invalid arguments</p>
  
  <p>Error   3   Argument 3: cannot convert from 'System.StringComparison' to 'System.Collections.Generic.IEqualityComparer' </p>
  
  <p>Forgot to add this error for the code below</p>
  
  <pre><code>return (from x in wq where x.strLocationSearch.StartsWith(searchString, StringComparison.OrdinalIgnoreCase) &amp;&amp; x.strCategory = context select x.strLocationSearch).AsEnumerable();
  </code></pre>
  
  <p>Error message: Error    1 Operator '&amp;&amp;' cannot be applied to operands of type 'bool' and 'string'</p>