DefaultHtmlGenerator.GenerateSelect Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
GenerateSelect(ViewContext, ModelExplorer, String, String, IEnumerable<SelectListItem>, Boolean, Object) |
Generate a <select> element for the |
GenerateSelect(ViewContext, ModelExplorer, String, String, IEnumerable<SelectListItem>, ICollection<String>, Boolean, Object) |
Generate a <select> element for the |
GenerateSelect(ViewContext, ModelExplorer, String, String, IEnumerable<SelectListItem>, Boolean, Object)
- Source:
- DefaultHtmlGenerator.cs
- Source:
- DefaultHtmlGenerator.cs
- Source:
- DefaultHtmlGenerator.cs
Generate a <select> element for the expression
.
public:
virtual Microsoft::AspNetCore::Mvc::Rendering::TagBuilder ^ GenerateSelect(Microsoft::AspNetCore::Mvc::Rendering::ViewContext ^ viewContext, Microsoft::AspNetCore::Mvc::ViewFeatures::ModelExplorer ^ modelExplorer, System::String ^ optionLabel, System::String ^ expression, System::Collections::Generic::IEnumerable<Microsoft::AspNetCore::Mvc::Rendering::SelectListItem ^> ^ selectList, bool allowMultiple, System::Object ^ htmlAttributes);
public Microsoft.AspNetCore.Mvc.Rendering.TagBuilder GenerateSelect (Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext, Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer modelExplorer, string optionLabel, string expression, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem> selectList, bool allowMultiple, object htmlAttributes);
abstract member GenerateSelect : Microsoft.AspNetCore.Mvc.Rendering.ViewContext * Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer * string * string * seq<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem> * bool * obj -> Microsoft.AspNetCore.Mvc.Rendering.TagBuilder
override this.GenerateSelect : Microsoft.AspNetCore.Mvc.Rendering.ViewContext * Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer * string * string * seq<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem> * bool * obj -> Microsoft.AspNetCore.Mvc.Rendering.TagBuilder
Public Function GenerateSelect (viewContext As ViewContext, modelExplorer As ModelExplorer, optionLabel As String, expression As String, selectList As IEnumerable(Of SelectListItem), allowMultiple As Boolean, htmlAttributes As Object) As TagBuilder
Parameters
- viewContext
- ViewContext
A ViewContext instance for the current scope.
- modelExplorer
- ModelExplorer
ModelExplorer for the expression
. If null
, determines validation
attributes using viewContext
and the expression
.
- optionLabel
- String
Optional text for a default empty <option> element.
- expression
- String
Expression name, relative to the current model.
- selectList
- IEnumerable<SelectListItem>
A collection of SelectListItem objects used to populate the <select> element with
<optgroup> and <option> elements. If null
, finds this collection at
ViewContext.ViewData[expression]
.
- allowMultiple
- Boolean
If true
, includes a multiple
attribute in the generated HTML. Otherwise generates a
single-selection <select> element.
- htmlAttributes
- Object
An Object that contains the HTML attributes for the <select> element. Alternatively, an IDictionary<TKey,TValue> instance containing the HTML attributes.
Returns
A new TagBuilder describing the <select> element.
Implements
Applies to
GenerateSelect(ViewContext, ModelExplorer, String, String, IEnumerable<SelectListItem>, ICollection<String>, Boolean, Object)
- Source:
- DefaultHtmlGenerator.cs
- Source:
- DefaultHtmlGenerator.cs
- Source:
- DefaultHtmlGenerator.cs
Generate a <select> element for the expression
.
public:
virtual Microsoft::AspNetCore::Mvc::Rendering::TagBuilder ^ GenerateSelect(Microsoft::AspNetCore::Mvc::Rendering::ViewContext ^ viewContext, Microsoft::AspNetCore::Mvc::ViewFeatures::ModelExplorer ^ modelExplorer, System::String ^ optionLabel, System::String ^ expression, System::Collections::Generic::IEnumerable<Microsoft::AspNetCore::Mvc::Rendering::SelectListItem ^> ^ selectList, System::Collections::Generic::ICollection<System::String ^> ^ currentValues, bool allowMultiple, System::Object ^ htmlAttributes);
public virtual Microsoft.AspNetCore.Mvc.Rendering.TagBuilder GenerateSelect (Microsoft.AspNetCore.Mvc.Rendering.ViewContext viewContext, Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer modelExplorer, string optionLabel, string expression, System.Collections.Generic.IEnumerable<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem> selectList, System.Collections.Generic.ICollection<string> currentValues, bool allowMultiple, object htmlAttributes);
abstract member GenerateSelect : Microsoft.AspNetCore.Mvc.Rendering.ViewContext * Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer * string * string * seq<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem> * System.Collections.Generic.ICollection<string> * bool * obj -> Microsoft.AspNetCore.Mvc.Rendering.TagBuilder
override this.GenerateSelect : Microsoft.AspNetCore.Mvc.Rendering.ViewContext * Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExplorer * string * string * seq<Microsoft.AspNetCore.Mvc.Rendering.SelectListItem> * System.Collections.Generic.ICollection<string> * bool * obj -> Microsoft.AspNetCore.Mvc.Rendering.TagBuilder
Public Overridable Function GenerateSelect (viewContext As ViewContext, modelExplorer As ModelExplorer, optionLabel As String, expression As String, selectList As IEnumerable(Of SelectListItem), currentValues As ICollection(Of String), allowMultiple As Boolean, htmlAttributes As Object) As TagBuilder
Parameters
- viewContext
- ViewContext
A ViewContext instance for the current scope.
- modelExplorer
- ModelExplorer
ModelExplorer for the expression
. If null
, determines validation
attributes using viewContext
and the expression
.
- optionLabel
- String
Optional text for a default empty <option> element.
- expression
- String
Expression name, relative to the current model.
- selectList
- IEnumerable<SelectListItem>
A collection of SelectListItem objects used to populate the <select> element with
<optgroup> and <option> elements. If null
, finds this collection at
ViewContext.ViewData[expression]
.
- currentValues
- ICollection<String>
An ICollection<T> containing values for <option> elements to select. If
null
, selects <option> elements based on Selected values in
selectList
.
- allowMultiple
- Boolean
If true
, includes a multiple
attribute in the generated HTML. Otherwise generates a
single-selection <select> element.
- htmlAttributes
- Object
An Object that contains the HTML attributes for the <select> element. Alternatively, an IDictionary<TKey,TValue> instance containing the HTML attributes.
Returns
A new TagBuilder describing the <select> element.