控件中多行的列(相同)合成一行一列_PreRender事件下邦定
for (int i = Repeater1.Items.Count - 1; i > 0; i--)
{
//txtName是需要合并列的列名
HtmlTableCell oCell_previous = Repeater1.Items[i - 1].FindControl("txtName") as HtmlTableCell;
HtmlTableCell oCell = Repeater1.Items[i].FindControl("txtName") as HtmlTableCell;
//hfName图片列的列名
HtmlTableCell oC_previous = Repeater1.Items[i - 1].FindControl("hfName") as HtmlTableCell;
HtmlTableCell oC = Repeater1.Items[i].FindControl("hfName") as HtmlTableCell;
if (oCell_previous != null && oCell != null)
{
oCell.RowSpan = (oCell.RowSpan == -1) ? 1 : oCell.RowSpan;
oCell_previous.RowSpan = (oCell_previous.RowSpan == -1) ? 1 : oCell_previous.RowSpan;
if (oCell.InnerText == oCell_previous.InnerText)
{
//姓名一样的
oCell.Visible = false;
oCell_previous.RowSpan += oCell.RowSpan;
}
}
}