I have the following table:-
<table class="table table-striped">
<thead>
<tr>
<th></th>
</tr>
</thead>
<tbody>
@foreach(var permisionMag in Model.PermisionManagement)
{
<tr>
<td>@permisionMag.Name</td>
@{
int i = 0;
<td class="f">
@foreach(var item in permisionMag.TechnologyTypes.OrderBy(a => a.Name)) {
@(i+1) @item.Name
i = i + 1;
}
<br />
</td>
}
</tr>
}
</tbody>
</table>
But currently i need the second column to have nested rows instead of showing the rows inside the same TD? any advice on this?
Tables can be nested together to create a table inside a table. To create a nested table, we need to create a table using the <table> tag. This table is known as the outer table. The second table that will be nested table is called the inner table.
A table can be created within another table by simply using the table tags like <table>, <tr>, <td>, etc., to create our nested table. Since nesting tables can lead to higher complexity levels, remember to begin and end the nesting tables within the same cell.
Click inside any cell in the larger table. Once again, use the “Insert” tab to create a table. For example, click on cell 1, go to “Insert,” “Table” and then create a 2-by-2 table. This 2-by-2 is now nested inside of the 3-by-3.
tr can only be a child of a table , thead , tfoot , etc.
You can not generate directly table cells, you have to generate a new table inside the second table cell.
You could also render @item.Name
as a span/div and style that to create the illusion of a nested table(jsFiddle example).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With