AjaxList

Declaration:
<% Meals.AjaxList()
    .Url(Page.Url().Action("Search", "MealsAjaxList")) %>
<awe:Ocon runat="server" ID="Meals" />
The url must return an
AjaxListResult
;
public ActionResult Search(int page, string parent)
{
    const int PageSize = 5;
    parent = (parent ?? "").ToLower();

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

    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 // bool - show More button or not
                    });
}



By accessing this site, you agree to store cookies on your device and disclose information in accordance with our cookie policy and privacy policy .