First Step
Download and unzip this file http://autocompletemvc.codeplex.com/releases/70140/download/259741
Second Step
Add jQueryExtensions.dll in your project (add reference -> jQueryExtensions.dll)
Add jquery-1.5.1.min.js, jquery-ui-1.8.11.min.js and jquery.ui.autocomplete.css in your project (note: css jquery ui is needed for proper presentation of the list)
Third step (for Anonymous Type)
@Html.AutoCompleteFor(model => model.Id, x => new { code = x.Code,Last_Value = x.LastValue }, "List") Where is...
  • Model.id => Is the field that you want to use as identification of an item;
  • code = its the name of parameter in action method
  • x.Code = Is the first field that will be used to display the values ​​of the data collection;
  • Last_Value = Is the label of second field that will be used to display the values ​​of the data collection;
  • LastValue= Is the value of second field that will be used to display the values ​​of the data collection;
  • "List" => Action (ActionResult of Controller) responsible for returning the data.

still in doubt ? Downloaded the sample application here http://autocompletemvc.codeplex.com/releases/70140/download/259743

Last edited Jul 22, 2011 at 12:11 PM by neocite, version 1

Comments

No comments yet.