I am using InputText for almost all the attributes. Some of the attributes are of type Double. When I bind the double value in InputText its giving me error. How can i resolve this? I dont want to use InputNumber.
<div class="form-group col">
<label title="The quantity ">Quantity</label>
<i class="fa fa-info-circle" style="color:dimgrey" title="The quantity">
</i>
<InputText @bind-Value="@trade.qty" class="form-control" />
<ValidationMessage For="@(() => trade.qty)" />
</div>
I am getting error at @trade.qty in <InputText @bind-Value="@trade.qty" class="form-control" />
as its a double value.
Model:
public Double qty { get; set; }
I tried something like <InputText @bind-Value="@trade.qty.ToString()" class="form-control" />
It didnt't work.
Use
<InputNumber @bind-Value=trade.qty min="1" max="999" />
It is bindable to double.
https://learn.microsoft.com/fr-fr/aspnet/core/blazor/forms-validation?view=aspnetcore-5.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With