Share via


SelectExtensions.ListBox Method

Definition

Overloads

ListBox(HtmlHelper, String)

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

ListBox(HtmlHelper, String, IEnumerable<SelectListItem>)

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

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

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

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

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

ListBox(HtmlHelper, String)

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

public static System.Web.Mvc.MvcHtmlString ListBox (this System.Web.Mvc.HtmlHelper htmlHelper, string name);
static member ListBox : System.Web.Mvc.HtmlHelper * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ListBox (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

ListBox(HtmlHelper, String, IEnumerable<SelectListItem>)

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

public static System.Web.Mvc.MvcHtmlString ListBox (this System.Web.Mvc.HtmlHelper htmlHelper, string name, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList);
static member ListBox : System.Web.Mvc.HtmlHelper * string * seq<System.Web.Mvc.SelectListItem> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ListBox (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

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

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

public static System.Web.Mvc.MvcHtmlString ListBox (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 ListBox : System.Web.Mvc.HtmlHelper * string * seq<System.Web.Mvc.SelectListItem> * System.Collections.Generic.IDictionary<string, obj> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ListBox (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

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

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

public static System.Web.Mvc.MvcHtmlString ListBox (this System.Web.Mvc.HtmlHelper htmlHelper, string name, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList, object htmlAttributes);
static member ListBox : System.Web.Mvc.HtmlHelper * string * seq<System.Web.Mvc.SelectListItem> * obj -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function ListBox (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