SelectExtensions.DropDownList Method

Definition

Overloads

DropDownList(HtmlHelper, String)

Returns a single-selection select element using the specified HTML helper and the name of the form field.

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>)

Returns a single-selection select element using the specified HTML helper, the name of the form field, and the specified list items.

DropDownList(HtmlHelper, String, String)

Returns a single-selection select element using the specified HTML helper, the name of the form field, and an option label.

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>, IDictionary<String,Object>)

Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, and the specified HTML attributes.

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>, Object)

Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, and the specified HTML attributes.

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>, String)

Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, and an option label.

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>, String, IDictionary<String,Object>)

Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, an option label, and the specified HTML attributes.

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>, String, Object)

Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, an option label, and the specified HTML attributes.

DropDownList(HtmlHelper, String)

Returns a single-selection select element using the specified HTML helper and the name of the form field.

public static System.Web.Mvc.MvcHtmlString DropDownList (this System.Web.Mvc.HtmlHelper htmlHelper, string name);
static member DropDownList : System.Web.Mvc.HtmlHelper * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function DropDownList (htmlHelper As HtmlHelper, name As String) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

name
String

The name of the form field to return.

Returns

An HTML select element.

Exceptions

The name parameter is null or empty.

Applies to

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>)

Returns a single-selection select element using the specified HTML helper, the name of the form field, and the specified list items.

public static System.Web.Mvc.MvcHtmlString DropDownList (this System.Web.Mvc.HtmlHelper htmlHelper, string name, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList);
static member DropDownList : System.Web.Mvc.HtmlHelper * string * seq<System.Web.Mvc.SelectListItem> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function DropDownList (htmlHelper As HtmlHelper, name As String, selectList As IEnumerable(Of SelectListItem)) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

name
String

The name of the form field to return.

selectList
IEnumerable<SelectListItem>

A collection of SelectListItem objects that are used to populate the drop-down list.

Returns

An HTML select element with an option subelement for each item in the list.

Exceptions

The name parameter is null or empty.

Applies to

DropDownList(HtmlHelper, String, String)

Returns a single-selection select element using the specified HTML helper, the name of the form field, and an option label.

public static System.Web.Mvc.MvcHtmlString DropDownList (this System.Web.Mvc.HtmlHelper htmlHelper, string name, string optionLabel);
static member DropDownList : System.Web.Mvc.HtmlHelper * string * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function DropDownList (htmlHelper As HtmlHelper, name As String, optionLabel As String) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

name
String

The name of the form field to return.

optionLabel
String

The text for a default empty item. This parameter can be null.

Returns

An HTML select element with an option subelement for each item in the list.

Exceptions

The name parameter is null or empty.

Applies to

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>, IDictionary<String,Object>)

Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, and the specified HTML attributes.

public static System.Web.Mvc.MvcHtmlString DropDownList (this System.Web.Mvc.HtmlHelper htmlHelper, string name, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
static member DropDownList : System.Web.Mvc.HtmlHelper * string * seq<System.Web.Mvc.SelectListItem> * System.Collections.Generic.IDictionary<string, obj> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function DropDownList (htmlHelper As HtmlHelper, name As String, selectList As IEnumerable(Of SelectListItem), htmlAttributes As IDictionary(Of String, Object)) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

name
String

The name of the form field to return.

selectList
IEnumerable<SelectListItem>

A collection of SelectListItem objects that are used to populate the drop-down list.

htmlAttributes
IDictionary<String,Object>

An object that contains the HTML attributes to set for the element.

Returns

An HTML select element with an option subelement for each item in the list.

Exceptions

The name parameter is null or empty.

Applies to

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>, Object)

Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, and the specified HTML attributes.

public static System.Web.Mvc.MvcHtmlString DropDownList (this System.Web.Mvc.HtmlHelper htmlHelper, string name, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList, object htmlAttributes);
static member DropDownList : System.Web.Mvc.HtmlHelper * string * seq<System.Web.Mvc.SelectListItem> * obj -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function DropDownList (htmlHelper As HtmlHelper, name As String, selectList As IEnumerable(Of SelectListItem), htmlAttributes As Object) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

name
String

The name of the form field to return.

selectList
IEnumerable<SelectListItem>

A collection of SelectListItem objects that are used to populate the drop-down list.

htmlAttributes
Object

An object that contains the HTML attributes to set for the element.

Returns

An HTML select element with an option subelement for each item in the list.

Exceptions

The name parameter is null or empty.

Applies to

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>, String)

Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, and an option label.

public static System.Web.Mvc.MvcHtmlString DropDownList (this System.Web.Mvc.HtmlHelper htmlHelper, string name, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList, string optionLabel);
static member DropDownList : System.Web.Mvc.HtmlHelper * string * seq<System.Web.Mvc.SelectListItem> * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function DropDownList (htmlHelper As HtmlHelper, name As String, selectList As IEnumerable(Of SelectListItem), optionLabel As String) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

name
String

The name of the form field to return.

selectList
IEnumerable<SelectListItem>

A collection of SelectListItem objects that are used to populate the drop-down list.

optionLabel
String

The text for a default empty item. This parameter can be null.

Returns

An HTML select element with an option subelement for each item in the list.

Exceptions

The name parameter is null or empty.

Applies to

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>, String, IDictionary<String,Object>)

Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, an option label, and the specified HTML attributes.

public static System.Web.Mvc.MvcHtmlString DropDownList (this System.Web.Mvc.HtmlHelper htmlHelper, string name, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList, string optionLabel, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
static member DropDownList : System.Web.Mvc.HtmlHelper * string * seq<System.Web.Mvc.SelectListItem> * string * System.Collections.Generic.IDictionary<string, obj> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function DropDownList (htmlHelper As HtmlHelper, name As String, selectList As IEnumerable(Of SelectListItem), optionLabel As String, htmlAttributes As IDictionary(Of String, Object)) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

name
String

The name of the form field to return.

selectList
IEnumerable<SelectListItem>

A collection of SelectListItem objects that are used to populate the drop-down list.

optionLabel
String

The text for a default empty item. This parameter can be null.

htmlAttributes
IDictionary<String,Object>

An object that contains the HTML attributes to set for the element.

Returns

An HTML select element with an option subelement for each item in the list.

Exceptions

The name parameter is null or empty.

Applies to

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>, String, Object)

Returns a single-selection select element using the specified HTML helper, the name of the form field, the specified list items, an option label, and the specified HTML attributes.

public static System.Web.Mvc.MvcHtmlString DropDownList (this System.Web.Mvc.HtmlHelper htmlHelper, string name, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList, string optionLabel, object htmlAttributes);
static member DropDownList : System.Web.Mvc.HtmlHelper * string * seq<System.Web.Mvc.SelectListItem> * string * obj -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function DropDownList (htmlHelper As HtmlHelper, name As String, selectList As IEnumerable(Of SelectListItem), optionLabel As String, htmlAttributes As Object) As MvcHtmlString

Parameters

htmlHelper
HtmlHelper

The HTML helper instance that this method extends.

name
String

The name of the form field to return.

selectList
IEnumerable<SelectListItem>

A collection of SelectListItem objects that are used to populate the drop-down list.

optionLabel
String

The text for a default empty item. This parameter can be null.

htmlAttributes
Object

An object that contains the HTML attributes to set for the element.

Returns

An HTML select element with an option subelement for each item in the list.

Exceptions

The name parameter is null or empty.

Applies to