[英]how to merge row in one column (GridView with merged cells)
我如何使用C#合並使用asp.net中的圖片的行網格視圖
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; } } }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.