Awesome Core and MVC Controls


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 ActionResult 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 ActionResult 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


We use cookies to improve your online experience. By accessing this site, you agree to the use of cookies and other technologies to process your personal data (e.g. IP address) to enhance and personalise your experience across our websites. Additionally, third-party companies, may store cookies on your device and use similar technologies to collect and use certain information. For more information, refer to our privacy policy and cookie policy.