【问题标题】:how to merge row in one column (GridView with merged cells)如何在一列中合并行(带有合并单元格的GridView)
【发布时间】:2015-03-16 07:52:03
【问题描述】:

如何使用 c# 合并使用行网格视图,如 asp.net 中的图片

【问题讨论】:

  • 这个问题你解决了吗?

标签: c# asp.net gridview


【解决方案1】:

您可以通过 GridView 的RowSpan 轻松实现。

您可以参考以下链接

GridView: Creating groups and summaries

Implement GridView Grouping: Group similar GridView Rows in ASP.Net

Grouping Data in ASP.NET Gridview Control

希望对你有帮助:)

【讨论】:

    【解决方案2】:
    for (int rowIndex = GridView1.Rows.Count - 2;  rowIndex >= 0; rowIndex--)
            {  GridViewRow gvRow = GridView1.Rows[rowIndex];  GridViewRow gvPreviousRow = GridView1.Rows[rowIndex + 1];
                for (int cellCount = 1; cellCount < gvRow.Cells.Count;  cellCount++)
                {    if (gvRow.Cells[cellCount].Text == gvPreviousRow.Cells[cellCount].Text)
                    {     if (gvPreviousRow.Cells[cellCount].RowSpan < 2)    {       gvRow.Cells[cellCount].RowSpan = 2;
                        }    else
                        {      gvRow.Cells[cellCount].RowSpan =  gvPreviousRow.Cells[cellCount].RowSpan + 1;       gvPreviousRow.Cells[cellCount].Visible = false;    }    }     }
    

    【讨论】:

      猜你喜欢
      • 2014-11-22
      • 2013-04-15
      • 1970-01-01
      • 2021-08-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-30
      相关资源
      最近更新 更多