Share via


SelectExtensions.DropDownListFor Method

Definition

Overloads

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

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

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

DropDownListFor<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.

DropDownListFor<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 using the specified list items.

DropDownListFor<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.

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

public static System.Web.Mvc.MvcHtmlString DropDownListFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList, string optionLabel, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
static member DropDownListFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> * seq<System.Web.Mvc.SelectListItem> * string * System.Collections.Generic.IDictionary<string, obj> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function DropDownListFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty)), selectList As IEnumerable(Of SelectListItem), optionLabel As String, htmlAttributes As IDictionary(Of String, Object)) As MvcHtmlString

Type Parameters

TModel

The type of the model.

TProperty

The type of the value.

Parameters

htmlHelper
HtmlHelper<TModel>

The HTML helper instance that this method extends.

expression
Expression<Func<TModel,TProperty>>

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

selectList
IEnumerable<SelectListItem>

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

optionLabel
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 for each property in the object that is represented by the expression.

Exceptions

The expression parameter is null.

Applies to

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

public static System.Web.Mvc.MvcHtmlString DropDownListFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList, string optionLabel);
static member DropDownListFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> * seq<System.Web.Mvc.SelectListItem> * string -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function DropDownListFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty)), selectList As IEnumerable(Of SelectListItem), optionLabel As String) As MvcHtmlString

Type Parameters

TModel

The type of the model.

TProperty

The type of the value.

Parameters

htmlHelper
HtmlHelper<TModel>

The HTML helper instance that this method extends.

expression
Expression<Func<TModel,TProperty>>

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

selectList
IEnumerable<SelectListItem>

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

optionLabel
String

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

Returns

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

Exceptions

The expression parameter is null.

Applies to

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

public static System.Web.Mvc.MvcHtmlString DropDownListFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList, string optionLabel, object htmlAttributes);
static member DropDownListFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> * seq<System.Web.Mvc.SelectListItem> * string * obj -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function DropDownListFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty)), selectList As IEnumerable(Of SelectListItem), optionLabel As String, htmlAttributes As Object) As MvcHtmlString

Type Parameters

TModel

The type of the model.

TProperty

The type of the value.

Parameters

htmlHelper
HtmlHelper<TModel>

The HTML helper instance that this method extends.

expression
Expression<Func<TModel,TProperty>>

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

selectList
IEnumerable<SelectListItem>

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

optionLabel
String

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

htmlAttributes
Object

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

Returns

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

Exceptions

The expression parameter is null.

Applies to

DropDownListFor<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.

public static System.Web.Mvc.MvcHtmlString DropDownListFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
static member DropDownListFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> * seq<System.Web.Mvc.SelectListItem> * System.Collections.Generic.IDictionary<string, obj> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function DropDownListFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty)), selectList As IEnumerable(Of SelectListItem), htmlAttributes As IDictionary(Of String, Object)) As MvcHtmlString

Type Parameters

TModel

The type of the model.

TProperty

The type of the value.

Parameters

htmlHelper
HtmlHelper<TModel>

The HTML helper instance that this method extends.

expression
Expression<Func<TModel,TProperty>>

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

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 for each property in the object that is represented by the expression.

Exceptions

The expression parameter is null.

Applies to

DropDownListFor<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 using the specified list items.

public static System.Web.Mvc.MvcHtmlString DropDownListFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList);
static member DropDownListFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> * seq<System.Web.Mvc.SelectListItem> -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function DropDownListFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty)), selectList As IEnumerable(Of SelectListItem)) As MvcHtmlString

Type Parameters

TModel

The type of the model.

TProperty

The type of the value.

Parameters

htmlHelper
HtmlHelper<TModel>

The HTML helper instance that this method extends.

expression
Expression<Func<TModel,TProperty>>

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

selectList
IEnumerable<SelectListItem>

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

Returns

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

Exceptions

The expression parameter is null.

Applies to

DropDownListFor<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.

public static System.Web.Mvc.MvcHtmlString DropDownListFor<TModel,TProperty> (this System.Web.Mvc.HtmlHelper<TModel> htmlHelper, System.Linq.Expressions.Expression<Func<TModel,TProperty>> expression, System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem> selectList, object htmlAttributes);
static member DropDownListFor : System.Web.Mvc.HtmlHelper<'Model> * System.Linq.Expressions.Expression<Func<'Model, 'Property>> * seq<System.Web.Mvc.SelectListItem> * obj -> System.Web.Mvc.MvcHtmlString
<Extension()>
Public Function DropDownListFor(Of TModel, TProperty) (htmlHelper As HtmlHelper(Of TModel), expression As Expression(Of Func(Of TModel, TProperty)), selectList As IEnumerable(Of SelectListItem), htmlAttributes As Object) As MvcHtmlString

Type Parameters

TModel

The type of the model.

TProperty

The type of the value.

Parameters

htmlHelper
HtmlHelper<TModel>

The HTML helper instance that this method extends.

expression
Expression<Func<TModel,TProperty>>

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

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 for each property in the object that is represented by the expression.

Exceptions

The expression parameter is null.

Applies to