If you use item.Id and item.Name on the client side, you must return no List<String> . Instead, you should return a list of new {Id=brand.BrandId, Name=brand.BrandName} . You should use LINQ instead of foreach :
return Json ((from brand in brands select new { Id = brand.BrandId, Name = brand.BrandName }).ToList());
UPDATED : I changed the demo for you from and turned on jQuery UI autocomplete support in two forms. Standard rendering:

and custom rendering:

The Autocomplete function works in the Advanced Search dialog box in the same way as in the Toolbar Search :

You can download the demo from here .
Autocomplete Server Code
public JsonResult GetTitleAutocomplete (string term) { var context = new HaackOverflowEntities(); return Json ((from item in context.Questions where item.Title.Contains (term) select item.Title).ToList(), JsonRequestBehavior.AllowGet); }
It returns an array of strings in JSON format. The list of titles is filtered using the term argument, which will be initialized with the line entered in the input field.
Custom Autocomplete Server Code
public JsonResult GetIds (string term) { var context = new HaackOverflowEntities(); return Json ((from item in context.Questions where SqlFunctions.StringConvert((decimal ?)item.Id).Contains(term) select new { value = item.Id,
It uses SqlFunctions.StringConvert to be able to use LIKE when comparing integers. In addition, it returns a list of objects that have a value title property. If you return objects that have the value lable properties, the values ββfrom the lable properties will be displayed in the Autocomplete context menu, and the corresponding value property will be inserted into the input field. Instead, we use our own title property.
Client Side Code
searchoptions: { dataInit: function (elem) { $(elem).autocomplete({ source: '<%= Url.Action("GetTitleAutocomplete") %>' }); } }
for standard rendering and
searchoptions: { sopt: ['eq', 'ne', 'lt', 'le', 'gt', 'ge'], dataInit: function (elem) {
for custom rendering.
In addition, I use some CSS settings:
.ui-autocomplete { max-height: 300px; overflow-y: auto; overflow-x: hidden; padding-right: 20px; } .ui-autocomplete.ui-menu .ui-menu-item { font-size: 0.75em; } .ui-autocomplete.ui-menu a.ui-state-hover { border-color: Tomato } .ui-resizable-handle { z-index: inherit !important; }
You can uncomment .ui-autocomplete.ui-menu { opacity: 0.9; } .ui-autocomplete.ui-menu { opacity: 0.9; } if you want to have a little opacity in the autocomplete context menu.