Pick a meal:

Lookup needs a controller or urls to be specified, by default convention the lookup will look for a controller with the same name as it + "LookupController"

  • action GetItem - used to show the value in the readonly field, it will receive a v parameter which is going to be the key of the selected item
  • action Search - gets data for the search result in it's popup, it should return a Json(AjaxListResult), so it has same features as the AjaxList (table layout, custom item template)
@(Html.Awe().LookupFor(o => o.Meal)
public class MealLookupController : Controller
public IActionResult GetItem(int? v)
Check.NotNull(v, "v");
var o = Db.Meals.SingleOrDefault(f => f.Id == v) ?? new Meal();

return Json(new KeyContent(o.Id, o.Name));

public IActionResult Search(string search, int page)
const int PageSize = 7;
search = (search ?? "").ToLower().Trim();

var list = Db.Meals.Where(o => o.Name.ToLower().Contains(search));

return Json(new AjaxListResult
Items = list.Skip((page - 1) * PageSize).Take(PageSize).Select(o => new KeyContent(o.Id, o.Name)),
More = list.Count() > page * PageSize