Your code specifically sets ECOSelected to true the first time the record is saved. I think ECOSelected is true the second time because you set it to true.
I'm wondering if this is another one of your Rube Goldberg designs where the community cannot help you fix the code because the fundamental the design does not work.
I see you are also implementing the empty setter again which is either a code smell or a very mean joke on the folks reviewing your code.
Anyway, the best I can do for you is provide a working example of how a checkbox works.
Model
public class CheckBoxModel
{
public bool IsChecked { get; set; }
}
Code
@page "/"
@using BlazorWasm.Models
@using BlazorWasm.Options
@using Microsoft.Extensions.Logging
@inject ILogger<Index> Logger
<PageTitle>Index</PageTitle>
<div>
<EditForm Model="@model" OnValidSubmit="@HandleValidSubmit">
<div>
Check: <input type="checkbox" @bind-value="model.IsChecked" />
</div>
<div>
<button type="submit">Submit</button>
</div>
</EditForm>
</div>
@code
{
private CheckBoxModel model = new();
private void HandleValidSubmit()
{
Logger.LogInformation(model.IsChecked.ToString());
if (model.IsChecked) {
Logger.LogInformation("I'm checked");
}
}
}
Lastly, ASP.NET Core Blazor forms and input components are covered in the official documentation. The code example above comes from the docs...