/// 合并GridView列
/// </summary>
/// <param name="gvMerge">合并的GridView ID</param>
/// <param name="cellNum">合并的列</param>
public static void GroupRows(GridView gvMerge, int cellNum)
{
int i = 0, rowSpanNum = 1;
while (i < gvMerge.Rows.Count - 1)
{
///GridViewRow 定义GridViewRow行
GridViewRow gvr = gvMerge.Rows[i];
for (++i; i < gvMerge.Rows.Count; i++)
{
///合并RowSpanNum
GridViewRow gvrNext = gvMerge.Rows[i];
if (gvr.Cells[cellNum].Text == gvrNext.Cells[cellNum].Text)
{
gvrNext.Cells[cellNum].Visible = false;
rowSpanNum++;
}
else
{
///
gvr.Cells[cellNum].RowSpan = rowSpanNum;
rowSpanNum = 1;
break;
}
if (i == gvMerge.Rows.Count - 1)
{
gvr.Cells[cellNum].RowSpan = rowSpanNum;
}
}
}
}