Multiple level cascading demo
Demonstrating how awesome controls cascade using binding to parent.
One control can be bound to multiple parents and parent controls can also be bound to other parent controls and so on.
Cascading ajax dropdowns
available items = [3, 7, 10] + parent value (or sum in case multiple parents)
Cascading Ajax RadioList and CheckboxList
Multiple dropdowns in a long cascade chain
Available items = parent value + [ "The", "brown", "cow", "is eating", "green", "grass"]
Try to get in the last dropdown "The brown cow is eating green grass" as the selected value.
MultipleLevelCascadingDemo/Index.cshtml
<p class="expl">
Demonstrating how awesome controls cascade using binding to parent. <br />
One control can be bound to multiple parents and parent controls can also be bound to other parent controls and so on.
</p>
<div>
<h2>Cascading ajax dropdowns</h2>
<div class="expl">
available items = [3, 7, 10] + parent value (or sum in case multiple parents)
</div>
<br/>
@Html.Awe().AjaxDropdown("a").Url(Url.Action("GetNumbers", "Data")).Value(3)
@Html.Awe().AjaxDropdown("b").Url(Url.Action("GetNumbers", "Data")).Parent("a").Value(10)
@Html.Awe().AjaxDropdown("c").Url(Url.Action("GetNumbers", "Data")).Parent("b").Value(17)
</div>
<div>
<h2>Cascading Ajax RadioList and CheckboxList </h2>
@Html.Awe().AjaxRadioList("a1").Ochk().Url(Url.Action("GetNumbers", "Data"))
@Html.Awe().AjaxCheckboxList("b1").Ochk().Url(Url.Action("GetNumbers", "Data")).Parent("a1")
@Html.Awe().AjaxRadioList("c1").Ochk().Url(Url.Action("GetNumbers", "Data")).Parent("b1")
@Html.Awe().AjaxRadioList("d1").Ochk().Url(Url.Action("GetNumbers", "Data")).Parent("b1").Parent("c1").Parent("a1")
</div>
<h2>Multiple dropdowns in a long cascade chain</h2>
<p class="expl">
Available items = parent value + [ "The", "brown", "cow", "is eating", "green", "grass"] <br />
Try to get in the last dropdown "The brown cow is eating green grass" as the selected value.
</p>
@Html.Awe().AjaxDropdown("a3").Url(Url.Action("GetWords", "Data"))
@Html.Awe().AjaxDropdown("b3").Url(Url.Action("GetWords", "Data")).Parent("a3")
@Html.Awe().AjaxDropdown("c3").Url(Url.Action("GetWords", "Data")).Parent("b3")
@Html.Awe().AjaxDropdown("d3").Url(Url.Action("GetWords", "Data")).Parent("c3")
@Html.Awe().AjaxDropdown("e3").Url(Url.Action("GetWords", "Data")).Parent("d3")
@Html.Awe().AjaxDropdown("f3").Url(Url.Action("GetWords", "Data")).Parent("e3")
Awesome/DataController.cs
public IActionResult GetNumbers(int[] parent)
{
parent = parent ?? new int[] { };
var items = new[] { 3, 7, 10 };
return Json(items.Select(o => o + parent.Sum()).Select(o => new KeyContent(o, o.ToString(CultureInfo.InvariantCulture))));
}
public IActionResult GetWords(string parent)
{
var items = new[] { "The", "brown", "cow", "is eating", "green", "grass" };
return Json(items.Select(o => parent + " " + o).Select(o => new KeyContent(o, o)));
}
Comments