合并单元格

后台增加排序
model.AdviseValue = list.OrderBy(tmp=>tmp.ConfigType).ToList(); 
 
<table class="tableList">
            <tr>
                <th>类别</th>
                <th>物品名称</th>
                <th>备注</th>
            </tr>
            @{
                var listType = new List<string>();
            }
            @foreach (var item in Model.AdviseValue)
            {
                int typeIndex = Model.AdviseValue.Count(tmp => tmp.ConfigType == item.ConfigType);
                <tr>
                    @if (!listType.Contains(item.ConfigType))
                    {
                        listType.Add(item.ConfigType);
                        <td style="width85px" rowspan="@typeIndex">@item.ConfigType</td>
                    }
                    <td style="width160px">@item.ConfigName</td>
                    <td style="text-alignleft;">@item.ConfigRemark</td>
                </tr>
            }
        </table>



原文地址:https://www.cnblogs.com/jzb-dev/p/34db55920352c7d66ad87e4c243712dc.html