SelectExtensions.ListBoxFor Method
Returns an HTML select element for each property in an object that is represented by an expression.
Assembly: System.Web.Mvc (in System.Web.Mvc.dll)
| Name | Description | |
|---|---|---|
![]() ![]() | ListBoxFor<'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. |
![]() ![]() | ListBoxFor<'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. |
![]() ![]() | ListBoxFor<'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. |
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.
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.MvcHtmlStringAn 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. |
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.
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<String, Object>
An object that contains the HTML attributes to set for the element.
Return Value
Type: System.Web.Mvc.MvcHtmlStringAn 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. |
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.
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.MvcHtmlStringAn 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. |

