Blog

Sitecore things

Sitecore best practices, architectures, EXM, SPEAK...

Sitecore SPEAK - MultiSelectList

In Sitecore SPEAK, I use ListControl to bind a data source and display items in that data source. The ListControl has selectedItem and selectedItemId attributes so that I can easily access the selected item/row in the list.

In order to select multiple items in the ListControl, we need to use a control called MultiSelectList. A MultiSelectList is a Behavior control instead of a "real" list control.

To add a MultiSelectList Behavior into a ListControl, I need to do the following steps:

  • Add a MultiSelectList rendering into the page. It is important that even if the ListControl is on a subpage, the MutlitSelectList should still be added on the main page.

enter image description here

  • In the ListControl, add MultiSelectList into the Behaviors property. No matter what the Id of the MultiSelectList is, it only needs to put the name of the control into the Behaviors property. Thus, only one MultiSelectList control is needed on a page and it can be reused by several ListControl controls on that page.

enter image description here

That’s it. When I open the page in my browser, I can see the check box in the first column of each row.

enter image description here

There are two more attributes i.e. checkedItems and checkedItemIds been added into the ListCotrol’s attributes.

enter image description here