0
I need to make a table that for each row I have the information as shown below
See that in Lot 1 until City the data does not repeat at each foreach and only from the column Species the data repeats, in this row the foreach makes the looping 3 times and the columns Lot until City suffers a rowspan
Below code that is not working accordingly.
@model GerenciamentoDeQuartos.Models.LoteViewModel
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<p>
@Html.ActionLink("Adicionar Lote", "NewLot")
</p>
<table class="table">
<tr>
<th>
@Html.DisplayNameFor(model => model.Lote.NumeroLote)
</th>
<th>
@Html.DisplayNameFor(model => model.Proprietario.Nome)
</th>
<th>
@Html.DisplayNameFor(model => model.Propriedade.Nome)
</th>
<th>
@Html.DisplayNameFor(model => model.Cidade.Nome)
</th>
<th>
@Html.DisplayNameFor(model => model.GetTipoGenero.Nome)
</th>
<th>
@Html.DisplayNameFor(model => model.GetGenero.QuantidadeAnimais)
</th>
<th>
@Html.DisplayNameFor(model => model.GetGenero.SequenciaInicial)
</th>
<th>
@Html.DisplayNameFor(model => model.GetGenero.SequenciaFinal)
</th>
</tr>
@foreach (var item in Model.LoteList)
{
var rowSpanTable = item.LoteGenero.Count() <= 1 ? 0 : item.LoteGenero.Count();
var imprimeSomentePrimeiraLinha = false;
<tr>
<td>
@Html.DisplayFor(modelItem => item.NumeroLote)
</td>
@foreach (var itemLoteGenero in item.LoteGenero)
{
if (!imprimeSomentePrimeiraLinha)
{
<td>
@Html.DisplayFor(modelItem => item.Proprietario.Nome)
</td>
<td>
@Html.DisplayFor(modelItem => item.Propriedade.Nome)
</td>
<td>
@Html.DisplayFor(modelItem => item.Propriedade.Cidade.Nome)
</td>
}
<td>
@Html.DisplayFor(modelItem => itemLoteGenero.Genero.TipoGenero.Nome)
</td>
<td>
@Html.DisplayFor(modelItem => itemLoteGenero.Genero.QuantidadeAnimais)
</td>
<td>
@Html.DisplayFor(modelItem => itemLoteGenero.Genero.SequenciaInicial)
</td>
<td>
@Html.DisplayFor(modelItem => itemLoteGenero.Genero.SequenciaFinal)
</td>
imprimeSomentePrimeiraLinha = true;
}
</tr>
}
</table>
What would be the expected result?
– Sam
The
rowspan
is supposed to be applied to which columns ?– Isac