前台:
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<tr>
<td class="col1" runat="server" id="col1">大厅</td>
<td class="col1"><%# Eval("UT_Text") %> </td>
<td class="col2">所属门店</td>
</tr>
</ItemTemplate>
</asp:Repeater>
后台处理:
Repeater1.DataSource = new UserTypeManager().GetByParID(1);
Repeater1.DataBind();
for (int i = 0; i < Repeater1.Items.Count;i++ )
{
if (i == 0)//合并第一行
(Repeater1.Items[i].FindControl("col1") as HtmlTableCell).RowSpan = Repeater1.Items.Count;
else//其它行设置为不可见自然就等于是删除了
(Repeater1.Items[i].FindControl("col1") as HtmlTableCell).Visible = false;
}
效果如下:
- 本文标题: ASP.NET之Table动态合并行,删除相同行的解决方案
- 文章分类:【.NET/Web】
- 非特殊说明,本文版权归【胡同里的砖头】个人博客 所有,转载请注明出处.