HtmlHelperSelectExtensions Class

Select-related extensions for Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper and Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper`1.

Namespace
Microsoft.AspNetCore.Mvc.Rendering
Assemblies
  • Microsoft.AspNetCore.Mvc.ViewFeatures

Syntax

public class HtmlHelperSelectExtensions
class Microsoft.AspNetCore.Mvc.Rendering.HtmlHelperSelectExtensions

Methods

DropDownList(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String)

Returns a single-selection HTML <select> element for the <em>expression</em>.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <select> element.

public static IHtmlContent DropDownList(this IHtmlHelper htmlHelper, string expression)
DropDownList(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>)

Returns a single-selection HTML <select> element for the <em>expression</em>, using the specified list items.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <select> element.

public static IHtmlContent DropDownList(this IHtmlHelper htmlHelper, string expression, IEnumerable<SelectListItem> selectList)
DropDownList(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>, System.Object)

Returns a single-selection HTML <select> element for the <em>expression</em>, using the specified list items and HTML attributes.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <select> element.

public static IHtmlContent DropDownList(this IHtmlHelper htmlHelper, string expression, IEnumerable<SelectListItem> selectList, object htmlAttributes)
DropDownList(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>, System.String)

Returns a single-selection HTML <select> element for the <em>expression</em>, using the specified list items and option label.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <select> element.

public static IHtmlContent DropDownList(this IHtmlHelper htmlHelper, string expression, IEnumerable<SelectListItem> selectList, string optionLabel)
DropDownList(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.String)

Returns a single-selection HTML <select> element for the <em>expression</em>, using the option label.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <select> element.

public static IHtmlContent DropDownList(this IHtmlHelper htmlHelper, string expression, string optionLabel)
DropDownListFor<TModel, TResult>(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>)

Returns a single-selection HTML <select> element for the <em>expression</em>, using the specified list items.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <select> element.

public static IHtmlContent DropDownListFor<TModel, TResult>(this IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, IEnumerable<SelectListItem> selectList)
DropDownListFor<TModel, TResult>(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>, System.Object)

Returns a single-selection HTML <select> element for the <em>expression</em>, using the specified list items and HTML attributes.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <select> element.

public static IHtmlContent DropDownListFor<TModel, TResult>(this IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, IEnumerable<SelectListItem> selectList, object htmlAttributes)
DropDownListFor<TModel, TResult>(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>, System.String)

Returns a single-selection HTML <select> element for the <em>expression</em>, using the specified list items and option label.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <select> element.

public static IHtmlContent DropDownListFor<TModel, TResult>(this IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, IEnumerable<SelectListItem> selectList, string optionLabel)
ListBox(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String)

Returns a multi-selection <select> element for the <em>expression</em>.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <select> element.

public static IHtmlContent ListBox(this IHtmlHelper htmlHelper, string expression)
ListBox(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper, System.String, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>)

Returns a multi-selection <select> element for the <em>expression</em>, using the specified list items.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <select> element.

public static IHtmlContent ListBox(this IHtmlHelper htmlHelper, string expression, IEnumerable<SelectListItem> selectList)
ListBoxFor<TModel, TResult>(Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<TModel>, System.Linq.Expressions.Expression<System.Func<TModel, TResult>>, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem>)

Returns a multi-selection <select> element for the <em>expression</em>, using the specified list items.

Arguments:
Return type:

Microsoft.AspNetCore.Html.IHtmlContent

Returns:

A new Microsoft.AspNetCore.Html.IHtmlContent containing the <select> element.

public static IHtmlContent ListBoxFor<TModel, TResult>(this IHtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TResult>> expression, IEnumerable<SelectListItem> selectList)