This project is read-only.


Jul 29, 2011 at 2:29 PM
Edited Jul 29, 2011 at 2:30 PM

I've found your AutoComplete to work only in the most basic sense.  If there is any kind of postback validation error and the page reposts with the model, it becomes useless.


If you change your code to this, which is a normal practice, the autocomplete bombs.

        public ActionResult Create(OrderModel order)
                throw new Exception("This represents some kind of exception occuring in our persisting of the user's entry");
                return View(order);

You will get an InvalidOperationException on this line in the view.


Exception Details:
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'.

Sep 27, 2012 at 4:03 PM
Edited Sep 27, 2012 at 4:04 PM

To ignore the current model use the following

@Html.AutoCompleteFor(model => new { Name=""}.Name, x =>  new { SearchName=""}.SearchName } , "Search")