<SfComboBox TValue="string" TItem="Countries" Placeholder="e.g. Australia" Value="@ComboVal" DataSource="@Country">
<ComboBoxEvents TValue="string" TItem="Countries" ValueChange="onChange"></ComboBoxEvents>
<ComboBoxFieldSettings Value="Name"></ComboBoxFieldSettings>
</SfComboBox>
@code {
public string ComboVal = "Austarila";
public class Countries
{
public string Name { get; set; }
public string Code { get; set; }
}
List<Countries> Country = new List<Countries>
{
new Countries() { Name = "Australia", Code = "AU" },
new Countries() { Name = "Bermuda", Code = "BM" },
new Countries() { Name = "Canada", Code = "CA" },
new Countries() { Name = "Cameroon", Code = "CM" },
};
private void onChange(Syncfusion.Blazor.DropDowns.ChangeEventArgs<string, Countries> args)
{
ComboVal = args.Value;
StateHasChanged();
}
}
|
<SfComboBox Placeholder="e.g. Australia" Value="@ComboVal" DataSource="@Country">
<ComboBoxEvents TValue="string" ValueChange="onChange"></ComboBoxEvents>
<ComboBoxFieldSettings Value="Name"></ComboBoxFieldSettings>
</SfComboBox>
<SfComboBox TValue="string" TItem="Countries" Placeholder="e.g. Australia" @bind-Value="@ComboVal" DataSource="@Country">
<ComboBoxEvents TValue="string" TItem="Countries" ValueChange="onChange"></ComboBoxEvents>
<ComboBoxFieldSettings Value="Name"></ComboBoxFieldSettings>
</SfComboBox>
@code {
public string ComboVal = "Australia";
public class Countries
{
public string Name { get; set; }
public string Code { get; set; }
}
List<Countries> Country = new List<Countries>
{
new Countries() { Name = "Australia", Code = "AU" },
new Countries() { Name = "Bermuda", Code = "BM" },
new Countries() { Name = "Canada", Code = "CA" },
new Countries() { Name = "Cameroon", Code = "CM" },
};
private void onChange(Syncfusion.Blazor.DropDowns.ChangeEventArgs<string, Countries> args)
{
//ComboVal = args.Value;
//StateHasChanged();
}
}
|