SelectList Constructors

Definition

Overloads

SelectList(IEnumerable)
SelectList(IEnumerable, Object)
SelectList(IEnumerable, String, String)
SelectList(IEnumerable, String, String, Object)
SelectList(IEnumerable, String, String, Object, String)

Initializes a new instance of the SelectList class by using the specified items for the list, the data value field, the data text field, a selected value, and the data group field.

SelectList(IEnumerable)

public:
 SelectList(System::Collections::IEnumerable ^ items);
public SelectList (System.Collections.IEnumerable items);
new Microsoft.AspNetCore.Mvc.Rendering.SelectList : System.Collections.IEnumerable -> Microsoft.AspNetCore.Mvc.Rendering.SelectList
Public Sub New (items As IEnumerable)

Parameters

items
IEnumerable

SelectList(IEnumerable, Object)

public:
 SelectList(System::Collections::IEnumerable ^ items, System::Object ^ selectedValue);
public SelectList (System.Collections.IEnumerable items, object selectedValue);
new Microsoft.AspNetCore.Mvc.Rendering.SelectList : System.Collections.IEnumerable * obj -> Microsoft.AspNetCore.Mvc.Rendering.SelectList
Public Sub New (items As IEnumerable, selectedValue As Object)

Parameters

items
IEnumerable
selectedValue
Object

SelectList(IEnumerable, String, String)

public:
 SelectList(System::Collections::IEnumerable ^ items, System::String ^ dataValueField, System::String ^ dataTextField);
public SelectList (System.Collections.IEnumerable items, string dataValueField, string dataTextField);
new Microsoft.AspNetCore.Mvc.Rendering.SelectList : System.Collections.IEnumerable * string * string -> Microsoft.AspNetCore.Mvc.Rendering.SelectList
Public Sub New (items As IEnumerable, dataValueField As String, dataTextField As String)

Parameters

items
IEnumerable
dataValueField
String
dataTextField
String

SelectList(IEnumerable, String, String, Object)

public:
 SelectList(System::Collections::IEnumerable ^ items, System::String ^ dataValueField, System::String ^ dataTextField, System::Object ^ selectedValue);
public SelectList (System.Collections.IEnumerable items, string dataValueField, string dataTextField, object selectedValue);
new Microsoft.AspNetCore.Mvc.Rendering.SelectList : System.Collections.IEnumerable * string * string * obj -> Microsoft.AspNetCore.Mvc.Rendering.SelectList
Public Sub New (items As IEnumerable, dataValueField As String, dataTextField As String, selectedValue As Object)

Parameters

items
IEnumerable
dataValueField
String
dataTextField
String
selectedValue
Object

SelectList(IEnumerable, String, String, Object, String)

Initializes a new instance of the SelectList class by using the specified items for the list, the data value field, the data text field, a selected value, and the data group field.

public:
 SelectList(System::Collections::IEnumerable ^ items, System::String ^ dataValueField, System::String ^ dataTextField, System::Object ^ selectedValue, System::String ^ dataGroupField);
public SelectList (System.Collections.IEnumerable items, string dataValueField, string dataTextField, object selectedValue, string dataGroupField);
new Microsoft.AspNetCore.Mvc.Rendering.SelectList : System.Collections.IEnumerable * string * string * obj * string -> Microsoft.AspNetCore.Mvc.Rendering.SelectList
Public Sub New (items As IEnumerable, dataValueField As String, dataTextField As String, selectedValue As Object, dataGroupField As String)

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.

selectedValue
Object

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

dataGroupField
String

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

Applies to