title: Blazor Handling Checkbox Toggle
body: <p>I am working on learning Blazor form controls by building a simple todo application.
  Running into an issue where I am not sure how to handle a checkbox click since I cannot use both @bind and @onchange in the same form control. I can just use onchange and it works but it does not check the checkbox automatically when viewing items that have been marked complete.</p>
  <p>Can someone please help me out and explain how I would handle the checkbox dynamically being checked or uncheck and also bind the boolean to it?</p>
  <p>Thanks in advance, here is what I am doing currently which does not show checked in the completed view.</p>
  <p>Todo Component</p>
  <pre><code>@using Project.Shared.Models
  @inject HttpClient Http
  &lt;div&gt;&lt;input type=&quot;checkbox&quot; @onchange=&quot;CheckChanged&quot; /&gt;@todo.Name&lt;/div&gt;
  @code {
      [Parameter]
      public Todo todo { get; set; }
  
      private async Task CheckChanged()
      {
          todo.Complete = !todo.Complete;
          await Http.PutAsJsonAsync(&quot;/api/Todo/Edit&quot;, todo);
      }
  }
  </code></pre>
  <p>Like I said this works, when I click the checkbox it will change the boolean in the database through the API, but the checkbox will not be checked when viewing completed items. When I do this it will check the checkbox on completed items but will not pick it up when it is clicked.</p>
  <pre><code>&lt;div&gt;&lt;input type=&quot;checkbox&quot; @bind=&quot;todo.Complete&quot; /&gt;@todo.Name&lt;/div&gt;
  </code></pre>
  <p>I also tried using value which would be my approach with a text input type but it doesn't work on checkboxes.</p>
  <p>I feel like using bind is the way to go but I cannot figure out how to pick up the checkbox selection when using bind.</p>