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
items
IEnumerableThe 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
items
IEnumerableThe items.
selectedValue
objectThe 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
items
IEnumerableThe items used to build each SelectListItem of the list.
selectedValue
objectThe selected value. Used to match the Selected property of the corresponding SelectListItem.
disabledValues
IEnumerableThe 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
items
IEnumerableThe items.
dataValueField
stringThe data value field.
dataTextField
stringThe 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
items
IEnumerableThe items.
dataValueField
stringThe data value field.
dataTextField
stringThe data text field.
selectedValue
objectThe 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
items
IEnumerableThe items used to build each SelectListItem of the list.
dataValueField
stringThe data value field. Used to match the Value property of the corresponding SelectListItem.
dataTextField
stringThe data text field. Used to match the Text property of the corresponding SelectListItem.
selectedValue
objectThe selected value. Used to match the Selected property of the corresponding SelectListItem.
disabledValues
IEnumerableThe 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
items
IEnumerableThe items used to build each SelectListItem of the list.
dataValueField
stringThe data value field. Used to match the Value property of the corresponding SelectListItem.
dataTextField
stringThe data text field. Used to match the Text property of the corresponding SelectListItem.
dataGroupField
stringThe data group field. Used to match the Group property of the corresponding SelectListItem.
selectedValue
objectThe 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
items
IEnumerableThe items used to build each SelectListItem of the list.
dataValueField
stringThe data value field. Used to match the Value property of the corresponding SelectListItem.
dataTextField
stringThe data text field. Used to match the Text property of the corresponding SelectListItem.
dataGroupField
stringThe data group field. Used to match the Group property of the corresponding SelectListItem.
selectedValue
objectThe selected value. Used to match the Selected property of the corresponding SelectListItem.
disabledValues
IEnumerableThe 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
items
IEnumerableThe items used to build each SelectListItem of the list.
dataValueField
stringThe data value field. Used to match the Value property of the corresponding SelectListItem.
dataTextField
stringThe data text field. Used to match the Text property of the corresponding SelectListItem.
dataGroupField
stringThe data group field. Used to match the Group property of the corresponding SelectListItem.
selectedValue
objectThe selected value. Used to match the Selected property of the corresponding SelectListItem.
disabledValues
IEnumerableThe disabled values. Used to match the Disabled property of the corresponding SelectListItem.
disabledGroups
IEnumerableThe 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.