zoukankan      html  css  js  c++  java
  • GridView 相同单元格合并

    效果如下:

    主要代码如下:
    public
    class GridDecorator { public static void MergeRows(GridView gridView) { for (int rowIndex = gridView.Rows.Count - 2; rowIndex >= 0; rowIndex--) { GridViewRow row = gridView.Rows[rowIndex]; GridViewRow previousRow = gridView.Rows[rowIndex + 1]; for (int i = 0; i < row.Cells.Count; i++) { if (row.Cells[i].Text == previousRow.Cells[i].Text) { row.Cells[i].RowSpan = previousRow.Cells[i].RowSpan < 2 ? 2 : previousRow.Cells[i].RowSpan + 1; previousRow.Cells[i].Visible = false; } } } } }
    如何使用:
    protected void gridView_PreRender(object sender, EventArgs e)
    {
        GridDecorator.MergeRows(gridView);
    }
  • 相关阅读:
    activiti--操作例子
    activiti--服务表
    spring--加载资源文件
    Day17
    Day15
    Day14
    Day13
    Day12
    Day16
    Day11
  • 原文地址:https://www.cnblogs.com/rongfengliang/p/3670434.html
Copyright © 2011-2022 走看看