HtmlHelperSelectExtensions Class

Definition

Select-related extensions for IHtmlHelper and IHtmlHelper<TModel>.

public ref class HtmlHelperSelectExtensions abstract sealed
public static class HtmlHelperSelectExtensions
type HtmlHelperSelectExtensions = class
Public Module HtmlHelperSelectExtensions
Inheritance
HtmlHelperSelectExtensions

Methods

DropDownList(IHtmlHelper, String)

Returns a single-selection HTML <select> element for the expression. Adds <option> elements based on the ViewData entry with full name. Adds a "selected" attribute to an <option> if its Value (if non-null) or Text matches the first non-null value found in: the ModelState entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

DropDownList(IHtmlHelper, String, IEnumerable<SelectListItem>)

Returns a single-selection HTML <select> element for the expression. Adds <option> elements based on selectList. Adds a "selected" attribute to an <option> if its Value (if non-null) or Text matches the first non-null value found in: the ModelState entry with full name, the ViewData entry with full name (unless used instead of selectList), or the expression evaluated against Model. See Name(String) for more information about a "full name".

DropDownList(IHtmlHelper, String, IEnumerable<SelectListItem>, Object)

Returns a single-selection HTML <select> element for the expression. Adds <option> elements based on selectList. Adds a "selected" attribute to an <option> if its Value (if non-null) or Text matches the first non-null value found in: the ModelState entry with full name, the ViewData entry with full name (unless used instead of selectList), or the expression evaluated against Model. See Name(String) for more information about a "full name".

DropDownList(IHtmlHelper, String, IEnumerable<SelectListItem>, String)

Returns a single-selection HTML <select> element for the expression. Adds <option> elements based on optionLabel and selectList. Adds a "selected" attribute to an <option> if its Value (if non-null) or Text matches the first non-null value found in: the ModelState entry with full name, the ViewData entry with full name (unless used instead of selectList), or the expression evaluated against Model. See Name(String) for more information about a "full name".

DropDownList(IHtmlHelper, String, String)

Returns a single-selection HTML <select> element for the expression. Adds <option> elements based on optionLabel and the ViewData entry with full name. Adds a "selected" attribute to an <option> if its Value (if non-null) or Text matches the first non-null value found in: the ModelState entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

DropDownListFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, IEnumerable<SelectListItem>)

Returns a single-selection HTML <select> element for the expression. Adds <option> elements based on selectList. Adds a "selected" attribute to an <option> if its Value (if non-null) or Text matches the first non-null value found in: the ModelState entry with full name, or the expression evaluated against Model. See NameFor<TResult>(Expression<Func<TModel,TResult>>) for more information about a "full name".

DropDownListFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, IEnumerable<SelectListItem>, Object)

Returns a single-selection HTML <select> element for the expression. Adds <option> elements based on selectList. Adds a "selected" attribute to an <option> if its Value (if non-null) or Text matches the first non-null value found in: the ModelState entry with full name, or the expression evaluated against Model. See NameFor<TResult>(Expression<Func<TModel,TResult>>) for more information about a "full name".

DropDownListFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, IEnumerable<SelectListItem>, String)

Returns a single-selection HTML <select> element for the expression. Adds <option> elements based on optionLabel and selectList. Adds a "selected" attribute to an <option> if its Value (if non-null) or Text matches the first non-null value found in: the ModelState entry with full name, or the expression evaluated against Model. See NameFor<TResult>(Expression<Func<TModel,TResult>>) for more information about a "full name".

ListBox(IHtmlHelper, String)

Returns a multi-selection <select> element for the expression. Adds <option> elements based on the ViewData entry with full name. Adds a "selected" attribute to an <option> if its Value (if non-null) or Text matches the first non-null value found in: the ModelState entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

ListBox(IHtmlHelper, String, IEnumerable<SelectListItem>)

Returns a multi-selection <select> element for the expression. Adds <option> elements based on selectList. Adds a "selected" attribute to an <option> if its Value (if non-null) or Text matches the first non-null value found in: the ModelState entry with full name, the ViewData entry with full name (unless used instead of selectList), or the expression evaluated against Model. See Name(String) for more information about a "full name".

ListBoxFor<TModel,TResult>(IHtmlHelper<TModel>, Expression<Func<TModel,TResult>>, IEnumerable<SelectListItem>)

Returns a multi-selection <select> element for the expression. Adds <option> elements based on selectList. Adds a "selected" attribute to an <option> if its Value (if non-null) or Text matches the first non-null value found in: the ModelState entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

Applies to