# Cascading ListBoxes

## Environment

<table>
 <tr>
  <td>Product</td>
  <td>ListBox for Progress® Telerik® UI for ASP.NET MVC</td>
 </tr>
</table>

## Description

I have a few Telerik MVC ListBoxes with selection buttons (to move listitems) between one and the other linked ListBoxes.

I would like to force a refresh of the third ListBox when an item is removed or added from the first. It should cascade to only show the list items that are applicable to the items that are left in the first box.

## Solution

I would suggest to pass the selected dataItems from listbox 1 in the `Read().Data()` method of listbox 3 when `add` or `remove` events occur and call the `read()` method of the third ListBox:

```
    @(Html.Kendo().ListBox()
        .Name("selectedGeoRegion")
        .Add("changeGeoRegion")
        .Remove("changeGeoRegion"))

    @(Html.Kendo().ListBox()
        .Name("selectedSwarmer")
        .DataSource(source => source
        .Read(read => read.Action("GetSwarmersForRegions", "Swarm")
        .Type(HttpVerbs.Post).Data("getselectedGeoRegions")
    ))

    <script>
        function changeGeoRegion() {
          setTimeout(function () {
               var selectedSwarmerListBox = $("#selectedSwarmer").data("kendoListBox");
               selectedSwarmerListBox.dataSource.read();
          });
        }

        function getselectedGeoRegions() {
            var theGeoRegionListBoxItems = $("#selectedGeoRegion").data("kendoListBox").dataItems();           
            return { RegionsSelected: theGeoRegionListBoxItems.length ? theGeoRegionListBoxItems.toJSON() : []  };
        }
    </script>
```

## More ASP.NET MVC ListBox Resources

* [ASP.NET MVC ListBox Documentation](https://www.telerik.com/aspnet-mvc/documentation/html-helpers/editors/listbox/overview)

* [ASP.NET MVC ListBox Demos](https://demos.telerik.com/aspnet-mvc/listbox)

* [ASP.NET MVC ListBox Product Page](https://www.telerik.com/aspnet-mvc/listbox)

* [Telerik UI for ASP.NET MVC Video Onboarding Course (Free for trial users and license holders)](https://www.telerik.com/aspnet-mvc/documentation/getting-started/video-onboarding)

* [Telerik UI for ASP.NET MVC Forums](https://www.telerik.com/forums/aspnet-mvc)

## See Also

* [Client-Side API Reference of the ListBox for ASP.NET MVC](https://docs.telerik.com/kendo-ui/api/ui/listbox)
* [Server-Side API Reference of the ListBox for ASP.NET MVC](https://docs.telerik.com/aspnet-mvc/api/listbox)
* [Telerik UI for ASP.NET MVC Breaking Changes](https://www.telerik.com/aspnet-mvc/documentation/backwards-compatibility/2023-backwards-compatibility)
* [Telerik UI for ASP.NET MVC Knowledge Base](https://docs.telerik.com/aspnet-mvc/knowledge-base)
