repeater中合并单元格:
在repeater.bind()后直接加入以下代码:
for (int i = repeater1.Items.Count - 1; i > 0; i--)
{
HtmlTableCell rep_previous = rptInfo.Items[i-1].FindControl("tdDepName") as HtmlTableCell;
HtmlTableCell rep = repeater1.Items[i].FindControl("tdDepName") as HtmlTableCell;
rep .RowSpan = (rep.RowSpan == -1) ? 1 : rep.RowSpan;
rep_previous.RowSpan = (rep_previous.RowSpan == -1) ? 1 : rep_previous.RowSpan;
if (rep.InnerText == rep_previous.InnerText)
{
rep.Visible = false;
rep_previous.RowSpan += rep.RowSpan;
}
}