4列后自动换行思路:
int i = 0;
while (dr.Read())
{
    if (i % 4 == 0) 输出一行的开始
     输出这个数据
    if (i % 4 == 3) 输出一行的结束
    i++;
}

3列后自动换行思路:

html 例子:

<table style="border:none;width:100%;">
@if (Model != null && Model.Count > 0)
{
string html = string.Empty;
for (var i = 0; i < Model.Count; i++)
{
if (i % 3 == 0)
{
@:<tr>
}
<td class='coltit'>流量</td>
<td class='colval'> 0.00(立方/小时)</td>
if (i % 3 == 2)
{
@:</tr>
}
}

}
</table>

相关文章:

  • 2021-12-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-30
  • 2021-12-19
  • 2022-12-23
  • 2021-12-31
  • 2021-11-27
相关资源
相似解决方案