Hello,
Here is the issue we encoure since version 3.3.0 of Telerik for Blazor.
Everything worked fine in version 3.2.0. We have a simple Input model, and a classic form.
The behavior that we want is "when Value1 changes, Value2 must change with custom logic".
Here is our code:
<p>Value1 : @Person.Value1</p>
<p>Value2 : @Person.Value2</p>
<TelerikForm Model="@Person">
<FormValidation>
<DataAnnotationsValidator></DataAnnotationsValidator>
</FormValidation>
<FormItems>
<FormItem Field="@(nameof(Person.Value1))">
<Template>
<label class="k-label k-form-label">Value 1</label>
<div class="k-form-field-wrap">
<TelerikNumericTextBox Decimals="2"
Format="C"
Min="0"
Step="0.01m"
ValueChanged="@((decimal? v) => Value1ChangedHandler(v))"
Value="@Person.Value1"
ValueExpression="@(() => Person.Value1)">
</TelerikNumericTextBox>
<TelerikValidationMessage For="@(() => Person.Value1)"></TelerikValidationMessage>
</div>
</Template>
</FormItem>
<FormItem Field="@(nameof(Person.Value2))">
</FormItem>
</FormItems>
</TelerikForm>
public partial class Example
{
private Input Person { get; set; } = new();
protected override void OnInitialized()
{
Person = new()
{
Value1 = 1000,
Value2 = 2000,
};
base.OnInitialized();
}
private void Value1ChangedHandler(decimal? newValue1)
{
this.Person.Value1 = newValue1;
this.Person.Value2 = newValue1 * 2; // We tried to add StateHasChanged(), but not working as well
}
}
public class Input
{
public decimal? Value1 { get; set; }
public decimal? Value2 { get; set; }
}
I attach two GIF recordings, the first is version 3.2.0 (working as expected), the second is version 3.3.0, you will see that the behavior is very odd.
Thanks a lot in advance.
// Dylan