ButtonGroup

Basic usage

ButtonGroup/Index.cshtml
@(Html.Awe().ButtonGroup(new ButtonGroupOpt
{
Name = "Cats",
Url = Url.Action("GetCategories", "Data"),
}))

Multiple select

ButtonGroup/Index.cshtml
@(Html.Awe().ButtonGroup(new ButtonGroupOpt
{
Name = "Multi",
Url = Url.Action("GetMealsImgByCateg", "Data"),
Multiple = true
}
.Parameter("categories", Db.Categories[0].Id)))

Cascade



ButtonGroup/Index.cshtml
@(Html.Awe().ButtonGroup(new ButtonGroupOpt
{
Name = "CatDd",
Url = Url.Action("GetCategories", "Data"),
Value = Db.Categories[2].Id,
Multiple = true
}))
<br />
<br />
@(Html.Awe().ButtonGroup(new ButtonGroupOpt
{
Name = "MealsDd",
AutoSelectFirst = true,
Url = Url.Action("GetMeals", "Data")
}.Parent("CatDd", "categories")))
Awesome/DataController.cs
public IActionResult GetMeals(int[] categories)
{
categories = categories ?? new int[] { };
var items = Db.Meals.Where(o => categories.Contains(o.Category.Id))
.Select(o => new KeyContent(o.Id, o.Name));

return Json(items);
}



Comments