SelectExtensions.ListBoxFor Method

 

Returns an HTML select element for each property in an object that is represented by an expression.

Namespace:   System.Web.Mvc.Html
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticListBoxFor<'TModel, 'TProperty>(HtmlHelper<'TModel>, Expression<Func<'TModel, 'TProperty>>, IEnumerable<SelectListItem>)

Returns an HTML select element for each property in the object that is represented by the specified expression and using the specified list items.

System_CAPS_pubmethodSystem_CAPS_staticListBoxFor<'TModel, 'TProperty>(HtmlHelper<'TModel>, Expression<Func<'TModel, 'TProperty>>, IEnumerable<SelectListItem>, IDictionary<String, Object>)

Returns an HTML select element for each property in the object that is represented by the specified expression using the specified list items and HTML attributes.

System_CAPS_pubmethodSystem_CAPS_staticListBoxFor<'TModel, 'TProperty>(HtmlHelper<'TModel>, Expression<Func<'TModel, 'TProperty>>, IEnumerable<SelectListItem>, Object)

Returns an HTML select element for each property in the object that is represented by the specified expression using the specified list items and HTML attributes.

Return to top

SelectExtensions.ListBoxFor<'TModel, 'TProperty> Method (HtmlHelper<'TModel>, Expression<Func<'TModel, 'TProperty>>, IEnumerable<SelectListItem>)

Returns an HTML select element for each property in the object that is represented by the specified expression and using the specified list items.

No code example is currently available or this language may not be supported.

Parameters

htmlHelper
Type: System.Web.Mvc.HtmlHelper<'TModel>

The HTML helper instance that this method extends.

expression
Type: System.Linq.Expressions.Expression<Func<'TModel, 'TProperty>>

An expression that identifies the object that contains the properties to display.

selectList
Type: System.Collections.Generic.IEnumerable<SelectListItem>

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

Return Value

Type: System.Web.Mvc.MvcHtmlString

An HTML select element for each property in the object that is represented by the expression.

Type Parameters

TModel

The type of the model.

TProperty

The type of the property.

Exception Condition
ArgumentNullException

The expression parameter is null.

Return to top

SelectExtensions.ListBoxFor<'TModel, 'TProperty> Method (HtmlHelper<'TModel>, Expression<Func<'TModel, 'TProperty>>, IEnumerable<SelectListItem>, IDictionary<String, Object>)

Returns an HTML select element for each property in the object that is represented by the specified expression using the specified list items and HTML attributes.

No code example is currently available or this language may not be supported.

Parameters

htmlHelper
Type: System.Web.Mvc.HtmlHelper<'TModel>

The HTML helper instance that this method extends.

expression
Type: System.Linq.Expressions.Expression<Func<'TModel, 'TProperty>>

An expression that identifies the object that contains the properties to display.

selectList
Type: System.Collections.Generic.IEnumerable<SelectListItem>

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

htmlAttributes
Type: System.Collections.Generic.IDictionary<StringObject>

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

Return Value

Type: System.Web.Mvc.MvcHtmlString

An HTML select element for each property in the object that is represented by the expression.

Type Parameters

TModel

The type of the model.

TProperty

The type of the property.

Exception Condition
ArgumentNullException

The expression parameter is null.

Return to top

SelectExtensions.ListBoxFor<'TModel, 'TProperty> Method (HtmlHelper<'TModel>, Expression<Func<'TModel, 'TProperty>>, IEnumerable<SelectListItem>, Object)

Returns an HTML select element for each property in the object that is represented by the specified expression using the specified list items and HTML attributes.

No code example is currently available or this language may not be supported.

Parameters

htmlHelper
Type: System.Web.Mvc.HtmlHelper<'TModel>

The HTML helper instance that this method extends.

expression
Type: System.Linq.Expressions.Expression<Func<'TModel, 'TProperty>>

An expression that identifies the object that contains the properties to display.

selectList
Type: System.Collections.Generic.IEnumerable<SelectListItem>

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

htmlAttributes
Type: System.Object

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

Return Value

Type: System.Web.Mvc.MvcHtmlString

An HTML select element for each property in the object that is represented by the expression.

Type Parameters

TModel

The type of the model.

TProperty

The type of the property.

Exception Condition
ArgumentNullException

The expression parameter is null.

Return to top
Show: