Hi,
When programmatically updating a bound property of any Syncfusion Blazor input component, it triggers a field change on the form marking the EditContext as modified.
This is not how the built-in blazor inputs work.
To see the difference, you can use the following code:
@page "/"
@using Syncfusion.Blazor.Inputs
<EditForm Model="@Dto1">
<h4>
Form with SfTextBox
</h4>
<SfTextBox @bind-Value="Dto1.Name"></SfTextBox>
<br />
<h4>
EditContext.IsModified(): @context.IsModified()
</h4>
</EditForm>
<hr />
<EditForm Model="@Dto2">
<h4>
Form with InputText
</h4>
<InputText @bind-Value="Dto2.Name"></InputText>
<br />
<h4>
EditContext.IsModified(): @context.IsModified()
</h4>
</EditForm>
@code{
public class PersonDto
{
public string Name { get; set; }
}
public PersonDto Dto1 { get; set; } = new();
public PersonDto Dto2 { get; set; } = new();
protected override async Task OnInitializedAsync()
{
// Some call to the server to get some values
await Task.Delay(5000);
// Update some bound property on the dto
Dto1.Name = "1111";
Dto2.Name = "2222";
}
}
Is there a way to change this behavior?
Thanks in advance
Attachment:
BlazorApp5_5518a766.zip