0
votes

I have a razor component including a simple table that I want to use as an input table as following:

<label for="dependencies">Abhängigkeiten</label>
<table class="table table-striped">
  <tr>
    <th scope="col">Name</th>
    <th scope="col">Version</th>
    <th scope="col">Entfernen</th>
  </tr>
</table>

In the code section I have a property of type IEnumerable<T> that I want to bind dynamically to the table, so the content of the collection gets binded to the table. Which options do I have to do so?

1

1 Answers

2
votes
@foreach(var item in AllItems)
{
  <tr @key=item>
    <td>@item.Name
  </tr>
}

You can also do <InputText @bind=item.Name/> if you need to.