如何使用c#
合并使用行网格视图,如asp.net中的图片答案 0 :(得分: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
希望它对你有所帮助:))
答案 1 :(得分:0)
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; } } }