SelectExtensions.DropDownListFor Method

 

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

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

Overload List

Name Description
System_CAPS_pubmethodSystem_CAPS_static 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.

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

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

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

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

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

See Also

SelectExtensions Class
System.Web.Mvc.Html Namespace

Return to top

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

Syntax

public static MvcHtmlString DropDownListFor<TModel, TProperty>(
    this HtmlHelper<TModel> htmlHelper,
    Expression<Func<TModel, TProperty>> expression,
    IEnumerable<SelectListItem> selectList
)
public:
generic<typename TModel, typename TProperty>
[ExtensionAttribute]
static MvcHtmlString^ DropDownListFor(
    HtmlHelper<TModel>^ htmlHelper,
    Expression<Func<TModel, TProperty>^>^ expression,
    IEnumerable<SelectListItem^>^ selectList
)
static member DropDownListFor<'TModel, 'TProperty> : 
        htmlHelper:HtmlHelper<'TModel> *
        expression:Expression<Func<'TModel, 'TProperty>> *
        selectList:IEnumerable<SelectListItem> -> MvcHtmlString
<ExtensionAttribute>
Public Shared 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

Parameters

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

Exceptions

Exception Condition
ArgumentNullException

The expression parameter is null.

Return to top

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

Syntax

public static MvcHtmlString DropDownListFor<TModel, TProperty>(
    this HtmlHelper<TModel> htmlHelper,
    Expression<Func<TModel, TProperty>> expression,
    IEnumerable<SelectListItem> selectList,
    IDictionary<string, object> htmlAttributes
)
public:
generic<typename TModel, typename TProperty>
[ExtensionAttribute]
static MvcHtmlString^ DropDownListFor(
    HtmlHelper<TModel>^ htmlHelper,
    Expression<Func<TModel, TProperty>^>^ expression,
    IEnumerable<SelectListItem^>^ selectList,
    IDictionary<String^, Object^>^ htmlAttributes
)
static member DropDownListFor<'TModel, 'TProperty> : 
        htmlHelper:HtmlHelper<'TModel> *
        expression:Expression<Func<'TModel, 'TProperty>> *
        selectList:IEnumerable<SelectListItem> *
        htmlAttributes:IDictionary<string, Object> -> MvcHtmlString
<ExtensionAttribute>
Public Shared 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

Parameters

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

Exceptions

Exception Condition
ArgumentNullException

The expression parameter is null.

Return to top

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

Syntax

public static MvcHtmlString DropDownListFor<TModel, TProperty>(
    this HtmlHelper<TModel> htmlHelper,
    Expression<Func<TModel, TProperty>> expression,
    IEnumerable<SelectListItem> selectList,
    object htmlAttributes
)
public:
generic<typename TModel, typename TProperty>
[ExtensionAttribute]
static MvcHtmlString^ DropDownListFor(
    HtmlHelper<TModel>^ htmlHelper,
    Expression<Func<TModel, TProperty>^>^ expression,
    IEnumerable<SelectListItem^>^ selectList,
    Object^ htmlAttributes
)
static member DropDownListFor<'TModel, 'TProperty> : 
        htmlHelper:HtmlHelper<'TModel> *
        expression:Expression<Func<'TModel, 'TProperty>> *
        selectList:IEnumerable<SelectListItem> *
        htmlAttributes:Object -> MvcHtmlString
<ExtensionAttribute>
Public Shared 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

Parameters

  • 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 value.

Exceptions

Exception Condition
ArgumentNullException

The expression parameter is null.

Return to top

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

Syntax

public static MvcHtmlString DropDownListFor<TModel, TProperty>(
    this HtmlHelper<TModel> htmlHelper,
    Expression<Func<TModel, TProperty>> expression,
    IEnumerable<SelectListItem> selectList,
    string optionLabel
)
public:
generic<typename TModel, typename TProperty>
[ExtensionAttribute]
static MvcHtmlString^ DropDownListFor(
    HtmlHelper<TModel>^ htmlHelper,
    Expression<Func<TModel, TProperty>^>^ expression,
    IEnumerable<SelectListItem^>^ selectList,
    String^ optionLabel
)
static member DropDownListFor<'TModel, 'TProperty> : 
        htmlHelper:HtmlHelper<'TModel> *
        expression:Expression<Func<'TModel, 'TProperty>> *
        selectList:IEnumerable<SelectListItem> *
        optionLabel:string -> MvcHtmlString
<ExtensionAttribute>
Public Shared 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

Parameters

  • optionLabel
    Type: System.String

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

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

Exceptions

Exception Condition
ArgumentNullException

The expression parameter is null.

Return to top

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

Syntax

public static MvcHtmlString DropDownListFor<TModel, TProperty>(
    this HtmlHelper<TModel> htmlHelper,
    Expression<Func<TModel, TProperty>> expression,
    IEnumerable<SelectListItem> selectList,
    string optionLabel,
    IDictionary<string, object> htmlAttributes
)
public:
generic<typename TModel, typename TProperty>
[ExtensionAttribute]
static MvcHtmlString^ DropDownListFor(
    HtmlHelper<TModel>^ htmlHelper,
    Expression<Func<TModel, TProperty>^>^ expression,
    IEnumerable<SelectListItem^>^ selectList,
    String^ optionLabel,
    IDictionary<String^, Object^>^ htmlAttributes
)
static member DropDownListFor<'TModel, 'TProperty> : 
        htmlHelper:HtmlHelper<'TModel> *
        expression:Expression<Func<'TModel, 'TProperty>> *
        selectList:IEnumerable<SelectListItem> *
        optionLabel:string *
        htmlAttributes:IDictionary<string, Object> -> MvcHtmlString
<ExtensionAttribute>
Public Shared 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

Parameters

  • optionLabel
    Type: System.String

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

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

Exceptions

Exception Condition
ArgumentNullException

The expression parameter is null.

Return to top

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

Syntax

public static MvcHtmlString DropDownListFor<TModel, TProperty>(
    this HtmlHelper<TModel> htmlHelper,
    Expression<Func<TModel, TProperty>> expression,
    IEnumerable<SelectListItem> selectList,
    string optionLabel,
    object htmlAttributes
)
public:
generic<typename TModel, typename TProperty>
[ExtensionAttribute]
static MvcHtmlString^ DropDownListFor(
    HtmlHelper<TModel>^ htmlHelper,
    Expression<Func<TModel, TProperty>^>^ expression,
    IEnumerable<SelectListItem^>^ selectList,
    String^ optionLabel,
    Object^ htmlAttributes
)
static member DropDownListFor<'TModel, 'TProperty> : 
        htmlHelper:HtmlHelper<'TModel> *
        expression:Expression<Func<'TModel, 'TProperty>> *
        selectList:IEnumerable<SelectListItem> *
        optionLabel:string *
        htmlAttributes:Object -> MvcHtmlString
<ExtensionAttribute>
Public Shared 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

Parameters

  • optionLabel
    Type: System.String

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

  • 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 value.

Exceptions

Exception Condition
ArgumentNullException

The expression parameter is null.

Return to top