Multicheck



Multicheck is used for selecting multiple values from a list. Has the same features as the DropdownList except it can select more than one value.
Multicheck/Index.cshtml
@(Html.Awe().Multicheck(new MulticheckOpt
{
Name = "MealsMultiChk",
Value = new[] { Db.Meals[0].Id, Db.Meals[2].Id, Db.Meals[14].Id },
Url = Url.Action("GetMealsImg", "Data"),
ClearBtn = true
}.ImgItem()))
Awesome/DataController.cs
public IActionResult GetMealsImg()
{
var url = Url.Content(DemoUtils.MealsUrl);
var items = Db.Meals.OrderBy(m => m.Id).ToArray()
.Select(o => new MealDisplay(o.Id, o.Name, url + o.ImageName, o.Category.Id));

return Json(items);
}

Multicheck with submenu



Multicheck/Index.cshtml
@(Html.Awe().Multicheck(new MulticheckOpt
{
Name = "MealsMultiSbm",
Url = Url.Action("GetMealsTreeImg", "Data"),
Submenu = true
}.ImgItem()))
Awesome/DataController.cs
public IActionResult GetMealsTreeImg()
{
var url = Url.Content(DemoUtils.MealsUrl);

var res = new List<MealOitem>();
var meals = Db.Meals.ToArray();
var groups = meals.GroupBy(o => o.Category);
foreach (var g in groups)
{
res.Add(new MealOitem
{
Content = g.Key.Name,
Class = "o-itm",
NonVal = true,
Items = g.Select(meal => new MealOitem { Key = meal.Id, Content = meal.Name, url = url + meal.ImageName })
});
}

return Json(res);
}



Comments