razor is a template engine, not a component model. its just a string. once rendered in the browser, you can use jsinterop to access the dom (assuming you are coding in blazor).
if you want access the table row data from c#, then change the template to use an object array:
@code {
var data = new[]
{
new {
FirstName = "Lars",
LastName = "Vileid",
Product = "Caffe Espresso",
Quantity = "Low",
Price = "Low"
},
new {
FirstName = "Petra",
LastName = "Davolio",
Product = "Caffe Latte",
Quantity = 10,
Price = "High"
},
};
}
<table>
<thead>
<tr>
<th scope="col">First Name</th>
<th scope="col">Last Name</th>
<th scope="col">Product Name</th>
<th scope="col">Quantity</th>
<th scope="col">Price</th>
</tr>
</thead>
<tbody>
@foreach(var row in data) {
<tr>
<td>@FirstName</td>
<td>@LastName</td>
<td>@Product</td>
<td>@Quantity</td>
<td>@Price</td>
</tr>
}
</tbody>
</table>