IHtmlGenerator.GenerateSelect Méthode

Définition

Surcharges

GenerateSelect(ViewContext, ModelExplorer, String, String, IEnumerable<SelectListItem>, Boolean, Object)

Générez un <élément select> pour .expression

GenerateSelect(ViewContext, ModelExplorer, String, String, IEnumerable<SelectListItem>, ICollection<String>, Boolean, Object)

Générez un <élément select> pour .expression

GenerateSelect(ViewContext, ModelExplorer, String, String, IEnumerable<SelectListItem>, Boolean, Object)

Générez un <élément select> pour .expression

public:
 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
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

Paramètres

viewContext
ViewContext

Un ViewContext instance pour l’étendue actuelle.

modelExplorer
ModelExplorer

ModelExplorerpour .expression Si null, détermine les attributs de validation à l’aide viewContext de et .expression

optionLabel
String

Texte facultatif pour un élément d’option> vide <par défaut.

expression
String

Nom de l’expression, relatif au modèle actuel.

selectList
IEnumerable<SelectListItem>

Collection d’objets SelectListItem utilisée pour remplir l’élément select> avec <des <éléments optgroup> et <option>. Si nullla valeur est , recherche cette collection à l’emplacement ViewContext.ViewData[expression].

allowMultiple
Boolean

Si truela valeur est , inclut un multiple attribut dans le code HTML généré. Sinon, génère un élément select> à sélection <unique.

htmlAttributes
Object

Object qui contient les attributs HTML de l’élément <select>. IDictionary<TKey,TValue> Une instance contenant les attributs HTML.

Retours

Nouveau TagBuilder décrivant l’élément <select> .

Remarques

HtmlFieldPrefix Combine et expression pour définir <l’attribut « name » de l’élément sélectionné>. Assainit expression pour définir l’attribut « id » de l’élément.

Consultez GetCurrentValues(ViewContext, ModelExplorer, String, Boolean) pour plus d’informations sur la façon dont les valeurs actuelles sont déterminées.

S’applique à

GenerateSelect(ViewContext, ModelExplorer, String, String, IEnumerable<SelectListItem>, ICollection<String>, Boolean, Object)

Générez un <élément select> pour .expression

public:
 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 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
Public 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

Paramètres

viewContext
ViewContext

Un ViewContext instance pour l’étendue actuelle.

modelExplorer
ModelExplorer

ModelExplorerpour .expression Si null, détermine les attributs de validation à l’aide viewContext de et .expression

optionLabel
String

Texte facultatif pour un élément d’option> vide <par défaut.

expression
String

Nom de l’expression, relatif au modèle actuel.

selectList
IEnumerable<SelectListItem>

Collection d’objets SelectListItem utilisée pour remplir l’élément select> avec <des <éléments optgroup> et <option>. Si nullla valeur est , recherche cette collection à l’emplacement ViewContext.ViewData[expression].

currentValues
ICollection<String>

ICollection<T> contenant des valeurs pour <les éléments d’option> à sélectionner. Si nullla valeur est , sélectionne les <éléments d’option> en fonction Selected des valeurs dans selectList.

allowMultiple
Boolean

Si truela valeur est , inclut un multiple attribut dans le code HTML généré. Sinon, génère un élément select> à sélection <unique.

htmlAttributes
Object

Object qui contient les attributs HTML de l’élément <select>. IDictionary<TKey,TValue> Une instance contenant les attributs HTML.

Retours

Nouveau TagBuilder décrivant l’élément <select> .

Remarques

HtmlFieldPrefix Combine et expression pour définir <l’attribut « name » de l’élément sélectionné>. Assainit expression pour définir l’attribut « id » de l’élément.

Consultez GetCurrentValues(ViewContext, ModelExplorer, String, Boolean) pour plus d’informations sur la façon dont la currentValues collection peut être créée.

S’applique à