我得到JSON值并在表格中填充,但我需要在显示表格时将水平样式更改为垂直。我正在使用MVC控制器并更新模型,并将模型数据分配给table.unble,以便在第一列中获取序列号。如何将水平行更改为垂直列数据显示在html表中
我想要显示的表是这样的:
name deviceid time location status
1 123 10.50 kolkata 23
2 2332 11.11 hyderabad 44
3 333 04.54 chennai 11
but im getting the table format like this
name deviceid time location status
1 123 10.50 kolkata 23
1 2332 11.11 hyderabad 44
1 333 04.54 chennai 11
<table class="table table-striped">
<thead>
<tr class="success">
<th>Bin id</th>
<th>device id</th>
<th>filled in %</th>
<th>Updated time</th>
<th>Area</th>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr> <td class="success">1</td>
<td class="success">@item.deviceid</td>
<td class="danger">@item.Filled.ToString("N2") %</td>
<td class="info">@item.UpdatedTime</td>
<td class="warning">@item.Area</td>
</tr>
}
</tbody>
</table>
从0开始的值,你可以从1.binid 0,1,2,3 .. – Swapna
添加+1到@ {item.i + 1}
其显示0 + 1 – Swapna