Class DropDownListFieldSettings
A class that represents the Dropdown list fields to map with the data source and binds the data to the component.
Inherited Members
Namespace: Syncfusion.Blazor.DropDowns
Assembly: Syncfusion.Blazor.dll
Syntax
public class DropDownListFieldSettings : SfDataBoundComponent
Examples
<SfDropDownList TValue="string" TItem="Country" Placeholder="Select a country" DataSource="@Countries">
<DropDownListFieldSettings Text="Name" Value="Code"/>
</SfDropDownList>
@code{
public class Country
{
public string Name { get; set; }
public string Code { get; set; }
}
List<Country> Countries = new List<Country> {
new Country() { Name = "Australia", Code = "AU" },
new Country() { Name = "Bermuda", Code = "BM" },
new Country() { Name = "Canada", Code = "CA" }
};
}
Constructors
DropDownListFieldSettings()
Declaration
public DropDownListFieldSettings()
Properties
Disabled
Defines whether the particular field value is disabled or not.
Declaration
public string Disabled { get; set; }
Property Value
Type | Description |
---|---|
System.String |
|
Remarks
This property specifies whether the particular field value in the drop-down-list is disabled or not.
If set to true
, the field value will be disabled; otherwise, it will be enabled.
GroupBy
Gets or sets filed names to display the list in category-wise.
Declaration
public string GroupBy { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts a string value. The default value is |
Examples
<SfDropDownList TValue="string" TItem="Vegetables" Placeholder="Select a country" DataSource="@VegetablesList">
<DropDownListFieldSettings Text="Name" Value="ID" GroupBy="Category" />
</SfDropDownList>
@code{
public class Vegetables
{
public string ID { get; set; }
public string Name { get; set; }
public string Category { get; set; }
}
List<Vegetables> VegetablesList = new List<Vegetables> {
new Vegetables { Name = "Cabbage", Category = "Leafy and Salad", ID = "item1" },
new Vegetables { Name = "Chickpea", Category = "Beans", ID = "item2" },
new Vegetables { Name = "Green bean", Category = "Beans", ID = "item4" },
new Vegetables { Name = "Spinach", Category = "Leafy and Salad", ID = "item9" }
};
}
HtmlAttributes
Gets or sets a collection of additional attributes such as styles, classes, and more that will be applied to the pop-up list element.
Declaration
public string HtmlAttributes { get; set; }
Property Value
Type | Description |
---|---|
System.String | The value as dictionary collection.The default value is |
Remarks
If you configured both property and equivalent html attributes, then the component considers the property value.
IconCss
Gets or sets a CSS class string to include an icon or image for the dropdown list item.
Declaration
public string IconCss { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts a CSS class string separated by space to include an icon or image for the dropdown list item. The default value is |
Text
Gets or sets the text that maps the text field from the data source model for each list item.
Declaration
public string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts a string value. The default value is |
Remarks
If not mapped, the text field in the drop-down list item show as an empty text for each list item.
Value
Gets or sets the value that maps the value field from the data source for each list item.
Declaration
public string Value { get; set; }
Property Value
Type | Description |
---|---|
System.String | Accepts a string value. The default value is |
Remarks
If not mapped the text filed in the dropdown list item show as empty popup.