0

I am trying to use a nullable property with InputNumber built-in Blazor Component. When I use the property with @bind-Value attribute, it works fine. But when I am trying to use it like below, it is giving error 'Nullable object must have a value'

 <InputNumber class="form-control" ValueExpression="@(() => model.Amount)"
                             Value="@(model.Amount)"
                             ValueChanged="@((double? value) => AmountUpdated(value))" />

I have to implement some custom logic on ValueChanged event which is why I am trying to use bind values this way.

1
  • You'll have to show more code than that. At the very least, show your model class and the AmountUpdated signature. Commented Jul 28, 2021 at 6:14

1 Answer 1

2

I would try this

 ValueChanged="@((value) => AmountUpdated(value))"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.