Differences Between the SelectionList and List Classes
Although the SelectionList and List controls are similar, there are fundamental difference in functionality at design time and run time. Both classes maintain a collection of list items. However, whereas the List control is derived from the PagedControl and ultimately the MobileControl class, the SelectionList control is derived directly from the MobileControl class and does not have pagination handling properties, such as the ItemWeight property.
The major difference between the classes is that the SelectionList class supports single or multiple selected items. The SelectType property contains the ListSelectType enumerated value, which determines whether the SelectionList is in single or multiple selection mode.
With the List class, you can choose only single items in a list. In contrast, the SelectionList class enables you to specify a variety of list types, including CheckBox, DropDown, ListBox, MultiSelectListBox, and Radio.
A SelectionList control is in single selection mode when you set the SelectType property to any of the following:
To retrieve the current selected item in a SelectionList control while in single selection mode, use the SelectedIndex and Selection properties.
The CheckBox and MultiSelectListBox enumerated values indicate multiselect mode. To retrieve the selection, query each item's Selected property.
The following example shows how to retrieve the selected values from a multiselect list.
A List control contains a collection of items in the MobileListItem class. There are a number of ways that you can add items to a List control:
Create <Item> elements inside a list. Each <Item> element becomes a MobileListItem in the list, and its properties are set from attributes of the <Item> element.
Programmatically add items to the list using the List control's Items collection. You can construct a MobileListItem object and add it to the collection before rendering.
Bind the List control to data, specifically to any object that implements the IEnumerable interface or the IListSource interface, such as ArrayList or DataSet objects.