Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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 | |
|---|---|---|
![]() ![]() |
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>, 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>, 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) | 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, 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, 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
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 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
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.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
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.ObjectAn 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
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.
optionLabel
Type: System.StringThe 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
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.
optionLabel
Type: System.StringThe text for a default empty item. This parameter can be null.
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.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
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.
optionLabel
Type: System.StringThe text for a default empty item. This parameter can be null.
htmlAttributes
Type: System.ObjectAn 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
.jpeg)
.jpeg)