@using
Syncfusion.Blazor.DropDowns
<p>DropDownList value is:<strong>@DropVal</strong></p>
<SfDropDownList TValue="string" Placeholder="e.g. Australia"
TItem="Country" Width="300px" @bind-Value="@DropVal" DataSource="@Countries">
<DropDownListFieldSettings
Value="Name"></DropDownListFieldSettings>
<DropDownListEvents
Created="CreatedHandler" TItem="Country"
TValue="string"
/>
</SfDropDownList>
@code {
void CreatedHandler(object args)
{
// code here
}
public string DropVal = "Canada";
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" },
new Country() { Name = "Cameroon", Code = "CM" },
};
}
|