SelectExtensions.DropDownList SelectExtensions.DropDownList Method

Definition

Overloads

DropDownList(HtmlHelper, String) 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>) 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) 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>) 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) 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) 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>) 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) 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) 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

Parameters

htmlHelper
HtmlHelper HtmlHelper

The HTML helper instance that this method extends.

name
String String

The name of the form field to return.

Returns

An HTML select element.

Exceptions

The name parameter is null or empty.

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>) 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

Parameters

htmlHelper
HtmlHelper HtmlHelper

The HTML helper instance that this method extends.

name
String 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.

DropDownList(HtmlHelper, String, String) 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

Parameters

htmlHelper
HtmlHelper HtmlHelper

The HTML helper instance that this method extends.

name
String String

The name of the form field to return.

optionLabel
String 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.

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>, IDictionary<String,Object>) 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

Parameters

htmlHelper
HtmlHelper HtmlHelper

The HTML helper instance that this method extends.

name
String 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.

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>, Object) 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

Parameters

htmlHelper
HtmlHelper HtmlHelper

The HTML helper instance that this method extends.

name
String 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 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.

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>, String) 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

Parameters

htmlHelper
HtmlHelper HtmlHelper

The HTML helper instance that this method extends.

name
String 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 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.

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>, String, IDictionary<String,Object>) 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

Parameters

htmlHelper
HtmlHelper HtmlHelper

The HTML helper instance that this method extends.

name
String 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 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.

DropDownList(HtmlHelper, String, IEnumerable<SelectListItem>, String, Object) 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

Parameters

htmlHelper
HtmlHelper HtmlHelper

The HTML helper instance that this method extends.

name
String 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 String

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

htmlAttributes
Object 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