• Share
    • Twitter
    • LinkedIn
    • Facebook
    • Email
  • Feedback
  • Improve this Doc

Class HtmlSelectExtensions

Represents support for making selections in a list.

Inheritance
System.Object
HtmlSelectExtensions
Namespace: DotNetNuke.Web.Mvc.Helpers
Assembly: DotNetNuke.Web.Mvc.dll
Syntax
public static class HtmlSelectExtensions : object

Methods

| Improve this Doc View Source

DropDownList(DnnHtmlHelper, 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.

Declaration
public static MvcHtmlString DropDownList(this DnnHtmlHelper html, string name, IEnumerable<SelectListItem> selectList, IDictionary<string, object> htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String name

The name of the form field to return.

IEnumerable<SelectListItem> selectList

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

IDictionary<System.String, System.Object> htmlAttributes

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

Returns
Type Description
MvcHtmlString

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

Exceptions
Type Condition
System.ArgumentException

The name parameter is null or empty.

| Improve this Doc View Source

DropDownList(DnnHtmlHelper, 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.

Declaration
public static MvcHtmlString DropDownList(this DnnHtmlHelper html, string name, IEnumerable<SelectListItem> selectList, object htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String name

The name of the form field to return.

IEnumerable<SelectListItem> selectList

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

System.Object htmlAttributes

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

Returns
Type Description
MvcHtmlString

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

Exceptions
Type Condition
System.ArgumentException

The name parameter is null or empty.

| Improve this Doc View Source

DropDownList(DnnHtmlHelper, 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.

Declaration
public static MvcHtmlString DropDownList(this DnnHtmlHelper html, string name, IEnumerable<SelectListItem> selectList, string optionLabel, IDictionary<string, object> htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String name

The name of the form field to return.

IEnumerable<SelectListItem> selectList

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

System.String optionLabel

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

IDictionary<System.String, System.Object> htmlAttributes

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

Returns
Type Description
MvcHtmlString

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

Exceptions
Type Condition
System.ArgumentException

The name parameter is null or empty.

| Improve this Doc View Source

DropDownList(DnnHtmlHelper, 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.

Declaration
public static MvcHtmlString DropDownList(this DnnHtmlHelper html, string name, IEnumerable<SelectListItem> selectList, string optionLabel, object htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String name

The name of the form field to return.

IEnumerable<SelectListItem> selectList

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

System.String optionLabel

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

System.Object htmlAttributes

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

Returns
Type Description
MvcHtmlString

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

Exceptions
Type Condition
System.ArgumentException

The name parameter is null or empty.

| Improve this Doc View Source

DropDownList(DnnHtmlHelper, 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.

Declaration
public static MvcHtmlString DropDownList(this DnnHtmlHelper html, string name, IEnumerable<SelectListItem> selectList, string optionLabel)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String name

The name of the form field to return.

IEnumerable<SelectListItem> selectList

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

System.String optionLabel

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

Returns
Type Description
MvcHtmlString

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

Exceptions
Type Condition
System.ArgumentException

The name parameter is null or empty.

| Improve this Doc View Source

DropDownList(DnnHtmlHelper, 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.

Declaration
public static MvcHtmlString DropDownList(this DnnHtmlHelper html, string name, IEnumerable<SelectListItem> selectList)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String name

The name of the form field to return.

IEnumerable<SelectListItem> selectList

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

Returns
Type Description
MvcHtmlString

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

Exceptions
Type Condition
System.ArgumentException

The name parameter is null or empty.

| Improve this Doc View Source

DropDownList(DnnHtmlHelper, String, String)

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

Declaration
public static MvcHtmlString DropDownList(this DnnHtmlHelper html, string name, string optionLabel)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String name

The name of the form field to return.

System.String optionLabel

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

Returns
Type Description
MvcHtmlString

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

Exceptions
Type Condition
System.ArgumentException

The name parameter is null or empty.

| Improve this Doc View Source

DropDownList(DnnHtmlHelper, String)

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

Declaration
public static MvcHtmlString DropDownList(this DnnHtmlHelper html, string name)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String name

The name of the form field to return.

Returns
Type Description
MvcHtmlString

An HTML select element.

Exceptions
Type Condition
System.ArgumentException

The name parameter is null or empty.

| Improve this Doc View Source

DropDownListFor<TModel, TProperty>(DnnHtmlHelper<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.

Declaration
public static MvcHtmlString DropDownListFor<TModel, TProperty>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, IEnumerable<SelectListItem> selectList, IDictionary<string, object> htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TProperty>> expression

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

IEnumerable<SelectListItem> selectList

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

IDictionary<System.String, System.Object> htmlAttributes

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

Returns
Type Description
MvcHtmlString

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

Type Parameters
Name Description
TModel

The type of the model.

TProperty

The type of the value.

Exceptions
Type Condition
System.ArgumentNullException

The expression parameter is null.

| Improve this Doc View Source

DropDownListFor<TModel, TProperty>(DnnHtmlHelper<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.

Declaration
public static MvcHtmlString DropDownListFor<TModel, TProperty>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, IEnumerable<SelectListItem> selectList, object htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TProperty>> expression

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

IEnumerable<SelectListItem> selectList

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

System.Object htmlAttributes

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

Returns
Type Description
MvcHtmlString

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

Type Parameters
Name Description
TModel

The type of the model.

TProperty

The type of the value.

Exceptions
Type Condition
System.ArgumentNullException

The expression parameter is null.

| Improve this Doc View Source

DropDownListFor<TModel, TProperty>(DnnHtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, IEnumerable<SelectListItem>, String, 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, option label, and HTML attributes.

Declaration
public static MvcHtmlString DropDownListFor<TModel, TProperty>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, IEnumerable<SelectListItem> selectList, string optionLabel, IDictionary<string, object> htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TProperty>> expression

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

IEnumerable<SelectListItem> selectList

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

System.String optionLabel

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

IDictionary<System.String, System.Object> htmlAttributes

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

Returns
Type Description
MvcHtmlString

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

Type Parameters
Name Description
TModel

The type of the model.

TProperty

The type of the value.

Exceptions
Type Condition
System.ArgumentNullException

The expression parameter is null.

| Improve this Doc View Source

DropDownListFor<TModel, TProperty>(DnnHtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, IEnumerable<SelectListItem>, 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, option label, and HTML attributes.

Declaration
public static MvcHtmlString DropDownListFor<TModel, TProperty>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, IEnumerable<SelectListItem> selectList, string optionLabel, object htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TProperty>> expression

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

IEnumerable<SelectListItem> selectList

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

System.String optionLabel

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

System.Object htmlAttributes

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

Returns
Type Description
MvcHtmlString

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

Type Parameters
Name Description
TModel

The type of the model.

TProperty

The type of the value.

Exceptions
Type Condition
System.ArgumentNullException

The expression parameter is null.

| Improve this Doc View Source

DropDownListFor<TModel, TProperty>(DnnHtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, IEnumerable<SelectListItem>, String)

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

Declaration
public static MvcHtmlString DropDownListFor<TModel, TProperty>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, IEnumerable<SelectListItem> selectList, string optionLabel)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TProperty>> expression

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

IEnumerable<SelectListItem> selectList

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

System.String optionLabel

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

Returns
Type Description
MvcHtmlString

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

Type Parameters
Name Description
TModel

The type of the model.

TProperty

The type of the value.

Exceptions
Type Condition
System.ArgumentNullException

The expression parameter is null.

| Improve this Doc View Source

DropDownListFor<TModel, TProperty>(DnnHtmlHelper<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 using the specified list items.

Declaration
public static MvcHtmlString DropDownListFor<TModel, TProperty>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, IEnumerable<SelectListItem> selectList)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TProperty>> expression

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

IEnumerable<SelectListItem> selectList

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

Returns
Type Description
MvcHtmlString

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

Type Parameters
Name Description
TModel

The type of the model.

TProperty

The type of the value.

Exceptions
Type Condition
System.ArgumentNullException

The expression parameter is null.

| Improve this Doc View Source

EnumDropDownListFor<TModel, TEnum>(DnnHtmlHelper<TModel>, Expression<Func<TModel, TEnum>>, IDictionary<String, Object>)

Returns an HTML select element for each value in the enumeration that is represented by the specified expression.

Declaration
public static MvcHtmlString EnumDropDownListFor<TModel, TEnum>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TEnum>> expression, IDictionary<string, object> htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TEnum>> expression

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

IDictionary<System.String, System.Object> htmlAttributes

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

Returns
Type Description
MvcHtmlString

An HTML select element for each value in the enumeration that is represented by the expression.

Type Parameters
Name Description
TModel

The type of the model.

TEnum

The type of the value.

| Improve this Doc View Source

EnumDropDownListFor<TModel, TEnum>(DnnHtmlHelper<TModel>, Expression<Func<TModel, TEnum>>, Object)

Returns an HTML select element for each value in the enumeration that is represented by the specified expression.

Declaration
public static MvcHtmlString EnumDropDownListFor<TModel, TEnum>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TEnum>> expression, object htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TEnum>> expression

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

System.Object htmlAttributes

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

Returns
Type Description
MvcHtmlString

An HTML select element for each value in the enumeration that is represented by the expression.

Type Parameters
Name Description
TModel

The type of the model.

TEnum

The type of the value.

| Improve this Doc View Source

EnumDropDownListFor<TModel, TEnum>(DnnHtmlHelper<TModel>, Expression<Func<TModel, TEnum>>, String, IDictionary<String, Object>)

Returns an HTML select element for each value in the enumeration that is represented by the specified expression.

Declaration
public static MvcHtmlString EnumDropDownListFor<TModel, TEnum>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TEnum>> expression, string optionLabel, IDictionary<string, object> htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TEnum>> expression

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

System.String optionLabel

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

IDictionary<System.String, System.Object> htmlAttributes

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

Returns
Type Description
MvcHtmlString

An HTML select element for each value in the enumeration that is represented by the expression.

Type Parameters
Name Description
TModel

The type of the model.

TEnum

The type of the value.

| Improve this Doc View Source

EnumDropDownListFor<TModel, TEnum>(DnnHtmlHelper<TModel>, Expression<Func<TModel, TEnum>>, String, Object)

Returns an HTML select element for each value in the enumeration that is represented by the specified expression.

Declaration
public static MvcHtmlString EnumDropDownListFor<TModel, TEnum>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TEnum>> expression, string optionLabel, object htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TEnum>> expression

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

System.String optionLabel

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

System.Object htmlAttributes

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

Returns
Type Description
MvcHtmlString

An HTML select element for each value in the enumeration that is represented by the expression.

Type Parameters
Name Description
TModel

The type of the model.

TEnum

The type of the value.

| Improve this Doc View Source

EnumDropDownListFor<TModel, TEnum>(DnnHtmlHelper<TModel>, Expression<Func<TModel, TEnum>>, String)

Returns an HTML select element for each value in the enumeration that is represented by the specified expression.

Declaration
public static MvcHtmlString EnumDropDownListFor<TModel, TEnum>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TEnum>> expression, string optionLabel)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TEnum>> expression

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

System.String optionLabel

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

Returns
Type Description
MvcHtmlString

An HTML select element for each value in the enumeration that is represented by the expression.

Type Parameters
Name Description
TModel

The type of the model.

TEnum

The type of the value.

| Improve this Doc View Source

EnumDropDownListFor<TModel, TEnum>(DnnHtmlHelper<TModel>, Expression<Func<TModel, TEnum>>)

Returns an HTML select element for each value in the enumeration that is represented by the specified expression.

Declaration
public static MvcHtmlString EnumDropDownListFor<TModel, TEnum>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TEnum>> expression)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TEnum>> expression

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

Returns
Type Description
MvcHtmlString

An HTML select element for each value in the enumeration that is represented by the expression.

Type Parameters
Name Description
TModel

The type of the model.

TEnum

The type of the value.

| Improve this Doc View Source

ListBox(DnnHtmlHelper, 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.

Declaration
public static MvcHtmlString ListBox(this DnnHtmlHelper html, string name, IEnumerable<SelectListItem> selectList, IDictionary<string, object> htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String name

The name of the form field to return.

IEnumerable<SelectListItem> selectList

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

IDictionary<System.String, System.Object> htmlAttributes

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

Returns
Type Description
MvcHtmlString

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

Exceptions
Type Condition
System.ArgumentException

The name parameter is null or empty.

| Improve this Doc View Source

ListBox(DnnHtmlHelper, 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.

Declaration
public static MvcHtmlString ListBox(this DnnHtmlHelper html, string name, IEnumerable<SelectListItem> selectList, object htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String name

The name of the form field to return.

IEnumerable<SelectListItem> selectList

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

System.Object htmlAttributes

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

Returns
Type Description
MvcHtmlString

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

Exceptions
Type Condition
System.ArgumentException

The name parameter is null or empty.

| Improve this Doc View Source

ListBox(DnnHtmlHelper, 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.

Declaration
public static MvcHtmlString ListBox(this DnnHtmlHelper html, string name, IEnumerable<SelectListItem> selectList)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String name

The name of the form field to return.

IEnumerable<SelectListItem> selectList

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

Returns
Type Description
MvcHtmlString

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

Exceptions
Type Condition
System.ArgumentException

The name parameter is null or empty.

| Improve this Doc View Source

ListBox(DnnHtmlHelper, String)

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

Declaration
public static MvcHtmlString ListBox(this DnnHtmlHelper html, string name)
Parameters
Type Name Description
DnnHtmlHelper html

The HTML helper instance that this method extends.

System.String name

The name of the form field to return.

Returns
Type Description
MvcHtmlString

An HTML select element.

Exceptions
Type Condition
System.ArgumentException

The name parameter is null or empty.

| Improve this Doc View Source

ListBoxFor<TModel, TProperty>(DnnHtmlHelper<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.

Declaration
public static MvcHtmlString ListBoxFor<TModel, TProperty>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, IEnumerable<SelectListItem> selectList, IDictionary<string, object> htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TProperty>> expression

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

IEnumerable<SelectListItem> selectList

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

IDictionary<System.String, System.Object> htmlAttributes

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

Returns
Type Description
MvcHtmlString

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

Type Parameters
Name Description
TModel

The type of the model.

TProperty

The type of the property.

Exceptions
Type Condition
System.ArgumentNullException

The expression parameter is null.

| Improve this Doc View Source

ListBoxFor<TModel, TProperty>(DnnHtmlHelper<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.

Declaration
public static MvcHtmlString ListBoxFor<TModel, TProperty>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, IEnumerable<SelectListItem> selectList, object htmlAttributes)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TProperty>> expression

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

IEnumerable<SelectListItem> selectList

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

System.Object htmlAttributes

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

Returns
Type Description
MvcHtmlString

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

Type Parameters
Name Description
TModel

The type of the model.

TProperty

The type of the property.

Exceptions
Type Condition
System.ArgumentNullException

The expression parameter is null.

| Improve this Doc View Source

ListBoxFor<TModel, TProperty>(DnnHtmlHelper<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.

Declaration
public static MvcHtmlString ListBoxFor<TModel, TProperty>(this DnnHtmlHelper<TModel> html, Expression<Func<TModel, TProperty>> expression, IEnumerable<SelectListItem> selectList)
Parameters
Type Name Description
DnnHtmlHelper<TModel> html

The HTML helper instance that this method extends.

Expression<Func<TModel, TProperty>> expression

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

IEnumerable<SelectListItem> selectList

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

Returns
Type Description
MvcHtmlString

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

Type Parameters
Name Description
TModel

The type of the model.

TProperty

The type of the property.

Exceptions
Type Condition
System.ArgumentNullException

The expression parameter is null.

  • View Source
Back to top by the community, for the community... #DNNCMS