MultiSelect allows you to add, remove, and access specific items with minimal code. It also lets you display or hide the check boxes and dropdown button appearing in the control. Learn how they can be implemented.
To add items to the MultiSelect control, use Add method of ItemCollection class as shown in the following code. For example, the following code adds a name “Patrick Smith” in dropdown list of the MultiSelect control with the email id:
By default, editing is enabled in the MultiSelect control. However, you can choose to allow or restrict a user to edit tags in the control header through IsTagEditable property.
Back to TopMultiSelect lets you delete an item from the list using RemoveAt method of ItemCollection class as shown in the following code. The method takes one argument, index, which specifies the item to remove. For example, the following code deletes sixth entry from the list.
C# |
Copy Code
|
---|---|
mselect.Items.RemoveAt(5); |
To remove all the entries from the list, use Clear method as shown in the following code:
C# |
Copy Code
|
---|---|
mselect.Items.Clear(); |
By default, list of items in the MultiSelect control are displayed with check boxes. However, you can disable the default style by setting ShowCheckBoxes property to false.
To hide the check boxes from the list, use the following code:
Back to TopMultiSelect displays the dropdown button to show the list of available items. However, you can hide the dropdown button in the control by setting ShowDropDownButton property to false.
To hide the drop down button, use the following code:
Back to Top