BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
The Value field in the ComboBox component must be of type string when the AllowCustom feature is enabled. If you need to use a different type for the Value field, you can use the CustomValueSpecifier event to send the Item instead.
For more information, please refer to the documentation and sample code provided in the release notes at this link: https://blazor.syncfusion.com/documentation/release-notes/18.3.35?type=all#combobox
<div id="ControlRegion"> <div class='control-wrapper'> <p>@ComboVal</p> <SfComboBox TValue="decimal" TItem="EmployeeData" CssClass="template" Placeholder="Select a customer" DataSource="@Data" AllowCustom="true" AllowFiltering="true" @bind-Value="ComboVal"> <ComboBoxFieldSettings Value="UnitCost" Text="UnitCost"></ComboBoxFieldSettings> <ComboBoxEvents TValue="decimal" TItem="EmployeeData" CustomValueSpecifier="@customValue"></ComboBoxEvents> </SfComboBox> </div> </div>
@code { public decimal ComboVal;
private void customValue(CustomValueSpecifierEventArgs<EmployeeData> args) { args.Item = new EmployeeData() { UnitCost = decimal.Parse(args.Text), TypeOfUse = args.Text }; } public class EmployeeData { public string TypeOfUse { get; set; } public decimal UnitCost { get; set; } } List<EmployeeData> Data = new List<EmployeeData>();
} |
[ Reference ]
|
Good Day UdhayaKumar Duraisamy ,
Thanks for the reply .. it working..
Nelson
Thank you for letting us know that it's working! We are glad to help.