Class SelectList
Represents a list that lets users select one item.
public class SelectList : MultiSelectList, IEnumerable<SelectListItem>, IEnumerable
- Inheritance
-
SelectList
- Implements
- Inherited Members
Constructors
SelectList(IEnumerable)
Initializes a new instance of the SelectList class by using the specified items for the list.
public SelectList(IEnumerable items)
Parameters
itemsIEnumerableThe items.
SelectList(IEnumerable, object)
Initializes a new instance of the SelectList class by using the specified items for the list and a selected value.
public SelectList(IEnumerable items, object selectedValue)
Parameters
itemsIEnumerableThe items.
selectedValueobjectThe selected value.
SelectList(IEnumerable, object, IEnumerable)
Initializes a new instance of the SelectList class by using the specified items for the list, the selected value, and the disabled values.
public SelectList(IEnumerable items, object selectedValue, IEnumerable disabledValues)
Parameters
itemsIEnumerableThe items used to build each SelectListItem of the list.
selectedValueobjectThe selected value. Used to match the Selected property of the corresponding SelectListItem.
disabledValuesIEnumerableThe disabled values. Used to match the Disabled property of the corresponding SelectListItem.
SelectList(IEnumerable, string, string)
Initializes a new instance of the SelectList class by using the specified items for the list, the data value field, and the data text field.
public SelectList(IEnumerable items, string dataValueField, string dataTextField)
Parameters
itemsIEnumerableThe items.
dataValueFieldstringThe data value field.
dataTextFieldstringThe data text field.
SelectList(IEnumerable, string, string, object)
Initializes a new instance of the SelectList class by using the specified items for the list, the data value field, the data text field, and a selected value.
public SelectList(IEnumerable items, string dataValueField, string dataTextField, object selectedValue)
Parameters
itemsIEnumerableThe items.
dataValueFieldstringThe data value field.
dataTextFieldstringThe data text field.
selectedValueobjectThe selected value.
SelectList(IEnumerable, string, string, object, IEnumerable)
Initializes a new instance of the SelectList class by using the specified items for the list, the data value field, the data text field, the selected value, and the disabled values.
public SelectList(IEnumerable items, string dataValueField, string dataTextField, object selectedValue, IEnumerable disabledValues)
Parameters
itemsIEnumerableThe items used to build each SelectListItem of the list.
dataValueFieldstringThe data value field. Used to match the Value property of the corresponding SelectListItem.
dataTextFieldstringThe data text field. Used to match the Text property of the corresponding SelectListItem.
selectedValueobjectThe selected value. Used to match the Selected property of the corresponding SelectListItem.
disabledValuesIEnumerableThe disabled values. Used to match the Disabled property of the corresponding SelectListItem.
SelectList(IEnumerable, string, string, string, object)
Initializes a new instance of the SelectList class by using the specified items for the list, the data value field, the data text field, the data group field, and the selected value.
public SelectList(IEnumerable items, string dataValueField, string dataTextField, string dataGroupField, object selectedValue)
Parameters
itemsIEnumerableThe items used to build each SelectListItem of the list.
dataValueFieldstringThe data value field. Used to match the Value property of the corresponding SelectListItem.
dataTextFieldstringThe data text field. Used to match the Text property of the corresponding SelectListItem.
dataGroupFieldstringThe data group field. Used to match the Group property of the corresponding SelectListItem.
selectedValueobjectThe selected value. Used to match the Selected property of the corresponding SelectListItem.
SelectList(IEnumerable, string, string, string, object, IEnumerable)
Initializes a new instance of the SelectList class by using the specified items for the list, the data value field, the data text field, the data group field, the selected value, and the disabled values.
public SelectList(IEnumerable items, string dataValueField, string dataTextField, string dataGroupField, object selectedValue, IEnumerable disabledValues)
Parameters
itemsIEnumerableThe items used to build each SelectListItem of the list.
dataValueFieldstringThe data value field. Used to match the Value property of the corresponding SelectListItem.
dataTextFieldstringThe data text field. Used to match the Text property of the corresponding SelectListItem.
dataGroupFieldstringThe data group field. Used to match the Group property of the corresponding SelectListItem.
selectedValueobjectThe selected value. Used to match the Selected property of the corresponding SelectListItem.
disabledValuesIEnumerableThe disabled values. Used to match the Disabled property of the corresponding SelectListItem.
SelectList(IEnumerable, string, string, string, object, IEnumerable, IEnumerable)
Initializes a new instance of the SelectList class by using the specified items for the list, the data value field, the data text field, the data group field. the selected value, the disabled values, and the disabled groups.
public SelectList(IEnumerable items, string dataValueField, string dataTextField, string dataGroupField, object selectedValue, IEnumerable disabledValues, IEnumerable disabledGroups)
Parameters
itemsIEnumerableThe items used to build each SelectListItem of the list.
dataValueFieldstringThe data value field. Used to match the Value property of the corresponding SelectListItem.
dataTextFieldstringThe data text field. Used to match the Text property of the corresponding SelectListItem.
dataGroupFieldstringThe data group field. Used to match the Group property of the corresponding SelectListItem.
selectedValueobjectThe selected value. Used to match the Selected property of the corresponding SelectListItem.
disabledValuesIEnumerableThe disabled values. Used to match the Disabled property of the corresponding SelectListItem.
disabledGroupsIEnumerableThe disabled groups. Used to match the Disabled property of the corresponding SelectListGroup.
Properties
SelectedValue
Gets the list value that was selected by the user.
public object SelectedValue { get; }
Property Value
- object
The selected value.