Table of Contents

Class MultiSelectList

Namespace
System.Web.Mvc
Assembly
System.Web.Mvc.dll

Represents a list of items that users can select more than one item from.

public class MultiSelectList : IEnumerable<SelectListItem>, IEnumerable
Inheritance
MultiSelectList
Implements
Derived
Inherited Members

Constructors

MultiSelectList(IEnumerable)

Initializes a new instance of the MultiSelectList class by using the specified items to include in the list.

public MultiSelectList(IEnumerable items)

Parameters

items IEnumerable

The items.

Exceptions

ArgumentNullException

The items parameter is null.

MultiSelectList(IEnumerable, IEnumerable)

Initializes a new instance of the MultiSelectList class by using the specified items to include in the list and the selected values.

public MultiSelectList(IEnumerable items, IEnumerable selectedValues)

Parameters

items IEnumerable

The items.

selectedValues IEnumerable

The selected values.

Exceptions

ArgumentNullException

The items parameter is null.

MultiSelectList(IEnumerable, IEnumerable, IEnumerable)

Initializes a new instance of the MultiSelectList class by using the items to include in the list, the selected values, the disabled values.

public MultiSelectList(IEnumerable items, IEnumerable selectedValues, IEnumerable disabledValues)

Parameters

items IEnumerable

The items used to build each SelectListItem of the list.

selectedValues IEnumerable

The selected values field. Used to match the Selected property of the corresponding SelectListItem.

disabledValues IEnumerable

The disabled values. Used to match the Disabled property of the corresponding SelectListItem.

MultiSelectList(IEnumerable, string, string)

Initializes a new instance of the MultiSelectList class by using the items to include in the list, the data value field, and the data text field.

public MultiSelectList(IEnumerable items, string dataValueField, string dataTextField)

Parameters

items IEnumerable

The items.

dataValueField string

The data value field.

dataTextField string

The data text field.

Exceptions

ArgumentNullException

The items parameter is null.

MultiSelectList(IEnumerable, string, string, IEnumerable)

Initializes a new instance of the MultiSelectList class by using the items to include in the list, the data value field, the data text field, and the selected values.

public MultiSelectList(IEnumerable items, string dataValueField, string dataTextField, IEnumerable selectedValues)

Parameters

items IEnumerable

The items.

dataValueField string

The data value field.

dataTextField string

The data text field.

selectedValues IEnumerable

The selected values.

Exceptions

ArgumentNullException

The items parameter is null.

MultiSelectList(IEnumerable, string, string, IEnumerable, IEnumerable)

Initializes a new instance of the MultiSelectList class by using the items to include in the list, the data value field, the data text field, the selected values, and the disabled values.

public MultiSelectList(IEnumerable items, string dataValueField, string dataTextField, IEnumerable selectedValues, IEnumerable disabledValues)

Parameters

items IEnumerable

The items used to build each SelectListItem of the list.

dataValueField string

The data value field. Used to match the Value property of the corresponding SelectListItem.

dataTextField string

The data text field. Used to match the Text property of the corresponding SelectListItem.

selectedValues IEnumerable

The selected values field. Used to match the Selected property of the corresponding SelectListItem.

disabledValues IEnumerable

The disabled values. Used to match the Disabled property of the corresponding SelectListItem.

MultiSelectList(IEnumerable, string, string, string)

Initializes a new instance of the MultiSelectList class by using the items to include in the list, the data value field, the data text field, and the data group field.

public MultiSelectList(IEnumerable items, string dataValueField, string dataTextField, string dataGroupField)

Parameters

items IEnumerable

The items used to build each SelectListItem of the list.

dataValueField string

The data value field. Used to match the Value property of the corresponding SelectListItem.

dataTextField string

The data text field. Used to match the Text property of the corresponding SelectListItem.

dataGroupField string

The data group field. Used to match the Group property of the corresponding SelectListItem.

MultiSelectList(IEnumerable, string, string, string, IEnumerable)

Initializes a new instance of the MultiSelectList class by using the items to include in the list, the data value field, the data text field, the data group field, and the selected values.

public MultiSelectList(IEnumerable items, string dataValueField, string dataTextField, string dataGroupField, IEnumerable selectedValues)

Parameters

items IEnumerable

The items used to build each SelectListItem of the list.

dataValueField string

The data value field. Used to match the Value property of the corresponding SelectListItem.

dataTextField string

The data text field. Used to match the Text property of the corresponding SelectListItem.

dataGroupField string

The data group field. Used to match the Group property of the corresponding SelectListItem.

selectedValues IEnumerable

The selected values field. Used to match the Selected property of the corresponding SelectListItem.

MultiSelectList(IEnumerable, string, string, string, IEnumerable, IEnumerable)

Initializes a new instance of the MultiSelectList class by using the items to include in the list, the data value field, the data text field, the data group field, the selected values, and the disabled values.

public MultiSelectList(IEnumerable items, string dataValueField, string dataTextField, string dataGroupField, IEnumerable selectedValues, IEnumerable disabledValues)

Parameters

items IEnumerable

The items used to build each SelectListItem of the list.

dataValueField string

The data value field. Used to match the Value property of the corresponding SelectListItem.

dataTextField string

The data text field. Used to match the Text property of the corresponding SelectListItem.

dataGroupField string

The data group field. Used to match the Group property of the corresponding SelectListItem.

selectedValues IEnumerable

The selected values field. Used to match the Selected property of the corresponding SelectListItem.

disabledValues IEnumerable

The disabled values. Used to match the Disabled property of the corresponding SelectListItem.

MultiSelectList(IEnumerable, string, string, string, IEnumerable, IEnumerable, IEnumerable)

Initializes a new instance of the MultiSelectList class by using the items to include in the list, the data value field, the data text field, the data group field, the selected values, the disabled values, and the disabled groups.

public MultiSelectList(IEnumerable items, string dataValueField, string dataTextField, string dataGroupField, IEnumerable selectedValues, IEnumerable disabledValues, IEnumerable disabledGroups)

Parameters

items IEnumerable

The items used to build each SelectListItem of the list.

dataValueField string

The data value field. Used to match the Value property of the corresponding SelectListItem.

dataTextField string

The data text field. Used to match the Text property of the corresponding SelectListItem.

dataGroupField string

The data group field. Used to match the Group property of the corresponding SelectListItem.

selectedValues IEnumerable

The selected values field. Used to match the Selected property of the corresponding SelectListItem.

disabledValues IEnumerable

The disabled values. Used to match the Disabled property of the corresponding SelectListItem.

disabledGroups IEnumerable

The disabled groups. Used to match the Disabled property of the corresponding SelectListGroup.

Properties

DataGroupField

Gets the data group field.

public string DataGroupField { get; }

Property Value

string

DataTextField

Gets or sets the data text field.

public string DataTextField { get; }

Property Value

string

The data text field.

DataValueField

Gets or sets the data value field.

public string DataValueField { get; }

Property Value

string

The data value field.

DisabledGroups

Gets the disabled groups.

public IEnumerable DisabledGroups { get; }

Property Value

IEnumerable

DisabledValues

Gets the disabled values.

public IEnumerable DisabledValues { get; }

Property Value

IEnumerable

Items

Gets or sets the items in the list.

public IEnumerable Items { get; }

Property Value

IEnumerable

The items in the list.

SelectedValues

Gets or sets the selected values.

public IEnumerable SelectedValues { get; }

Property Value

IEnumerable

The selected values.

Methods

GetEnumerator()

Returns an enumerator that can be used to iterate through the collection.

public virtual IEnumerator<SelectListItem> GetEnumerator()

Returns

IEnumerator<SelectListItem>

An enumerator that can be used to iterate through the collection.