First Step

Download and unzip this file http://jqueryextensions.codeplex.com/releases/70473/download/261846

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

@Html.AutoCompleteFor(model => model.Id, x => x.Code , "List") Where is...

* Model.id => Is the field that you want to use as identification of an item;
* x.Code => Is the field that will be used to display the values ​​of the data collection;
* "List" => Action (ActionResult of Controller) responsible for returning the data.

@Html.AutoCompleteFor(model => model.Id, x => new { code = x.Code,Last_Value = x.LastValue } , "List") Where is... (for Anonymous Type)

* Model.id => Is the field that you want to use as identification of an item;

* code=> Is the name of parameters in remote action method;
* x.Code => Is the main 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.

This label not required but I believe it is the best way to present multiple fields / data.

by convention the symbol underscore is used to separate the words of a label

still in doubt ? Downloaded the sample application here http://jqueryextensions.codeplex.com/releases/70473/download/261847

Thanks for http://www.logosnap.com for providing a tool for designing the logo

Last edited Jul 23, 2011 at 1:53 AM by neocite, version 11

Comments

fenixbrood Sep 27, 2012 at 3:01 PM 
To ignore the current model use the following
@Html.AutoCompleteFor(model => new{Name=""}.Name, x => new {new {SearchName=""}.SearchName } , "List")

jeffreddy Jul 29, 2011 at 1:44 PM 
The partial view is causing so many problems that this really has no practical value. It only works for the most basic of views. I think you should call this a Beta release. You should also make the source code available, because I think what you have hidden from everyone could probably be fixed so it works, or at the least, would be useful for people to use the parts that work.

neocite Jul 21, 2011 at 4:42 AM 
I think I know what is happening Jefreddy.
If you want to create a new partial view, this new policy should have as a model @ model - on top of your cshtml the type of the new model. Here is an example.

partial view your new customer is then you will have something like _clientesAutoComplete
policy in their model (@ model) should be referenced in your model clientes@FullNamespace.CustomerModel

This should solve your problem.

jeffreddy Jul 20, 2011 at 11:44 PM 
I'm now trying the partial view like you did, but I get this exception.

The model item passed into the dictionary is of type 'jQueryExtensions.Samples.Models.OrderModel', but this dictionary requires a model item of type 'jQueryExtensions.Samples.Models.StockModel'.

jeffreddy Jul 20, 2011 at 11:37 PM 
I tried adding the partial view like you have, and I get an exception when this line @Html.Partial("_StockAutoComplete")
The exception is...The model item passed into the dictionary is of type 'jQueryExtensions.Samples.Models.OrderModel', but this dictionary requires a model item of type 'jQueryExtensions.Samples.Models.StockModel'.

My exception has my model types, but I substituted your model names just to be clearer.

neocite Jul 20, 2011 at 11:35 PM 
Jeffreddy this is the problem. Currently a partial control is required to use the autocomplete + annotations required date. I'm working to get this need.

Note that the problem of not displaying the message can be a problem in the naming convention. example:

CustomerModel
Id

ProductModel
CustomerModeld

If it is done similar to the example the message will be displayed.

Thanks for your help and I will work hard to launch a new release.

jeffreddy Jul 20, 2011 at 10:50 PM 
I've downloaded your example and it seems to work fine. However, when I put it into my own project, I can't get the validation message to display. The validation is working (can't post back), but the message doesn't get displayed. If I enter a valid value into the autocomplete box, I can post back and the value is stored in my model. The only difference between my code and yours is that I did not use a partial view.