Sdílet prostřednictvím


IHtmlGenerator.GenerateSelect Metoda

Definice

Přetížení

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

Vygenerujte <prvek select> pro expression.

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

Vygenerujte <prvek select> pro expression.

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

Zdroj:
IHtmlGenerator.cs

Vygenerujte <prvek select> pro 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

Parametry

viewContext
ViewContext

Instance ViewContext pro aktuální obor.

modelExplorer
ModelExplorer

ModelExplorer expressionpro . Pokud null, určí ověřovací atributy pomocí viewContext a expression.

optionLabel
String

Volitelný text pro výchozí prázdný <prvek option> .

expression
String

Název výrazu vzhledem k aktuálnímu modelu.

selectList
IEnumerable<SelectListItem>

Kolekce objektů sloužících SelectListItem k naplnění elementu <select> prvky <optgroup> a <option> . Pokud null, najde tuto kolekci na adrese ViewContext.ViewData[expression].

allowMultiple
Boolean

Pokud true, zahrne multiple atribut do vygenerovaného KÓDU HTML. V opačném případě vygeneruje element select> s jedním výběrem<.

htmlAttributes
Object

Obsahuje Object atributy HTML pro <element select> . Případně instance obsahující IDictionary<TKey,TValue> atributy HTML.

Návraty

Nový TagBuilder popis prvku <select> .

Poznámky

Kombinuje HtmlFieldPrefix a expression k nastavení <atributu "name" prvku select> . Sanitizes expression nastavit "id" atribut elementu.

Informace o způsobu určení aktuálních hodnot najdete v tématu GetCurrentValues(ViewContext, ModelExplorer, String, Boolean) .

Platí pro

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

Zdroj:
IHtmlGenerator.cs

Vygenerujte <prvek select> pro 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

Parametry

viewContext
ViewContext

Instance ViewContext pro aktuální obor.

modelExplorer
ModelExplorer

ModelExplorer expressionpro . Pokud null, určí ověřovací atributy pomocí viewContext a expression.

optionLabel
String

Volitelný text pro výchozí prázdný <prvek option> .

expression
String

Název výrazu vzhledem k aktuálnímu modelu.

selectList
IEnumerable<SelectListItem>

Kolekce objektů sloužících SelectListItem k naplnění elementu <select> prvky <optgroup> a <option> . Pokud null, najde tuto kolekci na adrese ViewContext.ViewData[expression].

currentValues
ICollection<String>

Obsahující ICollection<T> hodnoty pro <prvky možnosti> , které se mají vybrat. Pokud null, vybere <prvky možnosti> na Selected základě hodnot v selectList.

allowMultiple
Boolean

Pokud true, zahrne multiple atribut do vygenerovaného KÓDU HTML. V opačném případě vygeneruje element select> s jedním výběrem<.

htmlAttributes
Object

Obsahuje Object atributy HTML pro <element select> . Případně instance obsahující IDictionary<TKey,TValue> atributy HTML.

Návraty

Nový TagBuilder popis prvku <select> .

Poznámky

Kombinuje HtmlFieldPrefix a expression k nastavení <atributu "name" prvku select> . Sanitizes expression nastavit "id" atribut elementu.

Informace o tom, jak může být kolekce vytvořena, najdete v currentValues tématu GetCurrentValues(ViewContext, ModelExplorer, String, Boolean) .

Platí pro