Lookup Grid

Meal:
 

Lookup with grid inside the popup, done using the lookupgrid mod that also uses PopupUrl extension.
LookupDemo/Misc.cshtml
@(Html.Awe().LookupFor(o => o.MealCustomPopup)
.LookupGrid(Url.Action("MealLookup"))
.Controller("MealLookup"))
Awesome/Lookup/MealLookupController.cs
public class MealLookupController : Controller
{
public ActionResult GetItem(int? 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
});
}
}
LookupDemo/MealLookup.cshtml
@model AwesomeMvcDemo.ViewModels.Input.Lookup.LookupPopupInput
@using (Html.Awe().BeginContext()) {
<div class="bar">
@Html.Awe().TextBoxFor(o => o.Search).Placeholder("search...")
</div>
<div style="max-width: 900px">
@(Html.Awe().Grid("MealsGrid")
.Mod(o => o.PageInfo().ColumnsSelector().AutoMiniPager().KeyNav())
.Selectable(SelectionType.Single)
.Parent(o => o.Search, "name")
.Columns(
new Column { Bind = "Id", Width = 75, Groupable = false, Resizable = false },
new Column { Bind = "Name", Width = 150}.Mod(o => o.Nohide()),
new Column { Bind = "Description", CssClass = "txtlim"}.Mod(o => o.Autohide()))
.Url(Url.Action("MealsGrid", "Data"))
.Groupable(false)
.Height(350))
</div>
}

Lookup with Custom Items template

Meal:
 

The Search action of the LookupController returns json of AjaxListResult, we need to set the string AjaxListResult.Content instead of Items in order to achieve Custom Item Template, exactly the same as for the AjaxList helper.
LookupDemo/Misc.cshtml
@(Html.Awe().LookupFor(o => o.MealCustomItem)
.Mod(o => o.Dropdown(false))
.CustomSearch())

Lookup bound parents

Parent Categories:
  •  
Parent Category:
Child Meal:
 

Binding to parents and setting predefined parameters is done the same as for the AjaxDropdown using .Parent() and .Parameter(), values are passed to both GetItem and Search actions.
Unlike other controls the Lookup won't change its value when the value of the parent is changed.
LookupDemo/Misc.cshtml
<div class="efield">
<div class="elabel">
Parent Categories:
</div>
<div class="einput">
@(Html.Awe().MultiLookupFor(o => o.CategoriesData)
.Controller<CategoriesMultiLookupController>()
.ClearButton())
</div>
</div>
<div class="efield">
<div class="elabel">
Parent Category:
</div>
<div class="einput">
@Html.Awe().AjaxDropdownFor(o => o.Category).Url(Url.Action("GetCategories", "Data"))
</div>
</div>
<div class="efield">
<div class="elabel">
Child Meal:
</div>
<div class="einput">
@(Html.Awe().LookupFor(o => o.ChildOfMany)
.Parent(o => o.CategoriesData, "categories")
.Parent(o => o.Category, "categories")
.Controller<MealCustomSearchLookupController>()
.LookupGrid(Url.Action("MealLookup"))
.Controller("MealLookup"))
</div>
</div>

Setting predefinded parameters

Meal1 (categories = {Fruits, Legumes}):