TheBestTable

The best table

My previous understanding was that each row would require its own unique form tag, along with the necessary attributes and values needed to satisfy the endpoint handler. Imagining a page with *100 rows, we can start to understand the overhead the requirement could add to our pages.

<form id="remove" method="post" asp-page-handler="Remove">
  <button type="submit" name="id" value="@person.id">Remove</button>
</form>

HTML button tags can submit any form found on the page using the form attribute.

...

<!-- The form that remove buttons will use -->
<form id="remove" method="post"></form>

...

<button
  type="submit"
  name="id"
  value="@person.Id"
  form="remove"
  asp-page-handler="Remove"
  class="btn btn-danger btn-rounded btn-sm my-0"
>
  Remove
</button>