|
@using Syncfusion.Blazor.DropDowns
@using Syncfusion.Blazor.Inputs
<SfNumericTextBox TValue="int?" Value="@NumericValue"></SfNumericTextBox>
<SfDropDownList TValue="int?" Placeholder="Select Booking Type" TItem="Type" Value="@DropVal" DataSource="@BookingType">
<DropDownListEvents TValue="int?" ValueChange="onChange"></DropDownListEvents>
<DropDownListFieldSettings Value="Rate" Text="Name"></DropDownListFieldSettings>
</SfDropDownList>
@code {
public int? NumericValue { get; set; }
public int? DropVal;
public class Type
{
public string Name { get; set; }
public int? Rate { get; set; }
}
List<Type> BookingType = new List<Type>
{
new Type() { Name = "BookingType1", Rate = 180 },
new Type() { Name = "BookingType2", Rate = 200 },
new Type() { Name = "BookingType3", Rate = 250 }
};
private void onChange(Syncfusion.Blazor.DropDowns.ChangeEventArgs<int?> args) // It triggers whenever we selecting the value from dropdownlist
{
DropVal = args.Value; // To get the value for based on the BookingType
NumericValue = DropVal; // Map the Rate value to NumericTextbox
StateHasChanged();
}
} |