簡體   English   中英

如何合並一列中的行(具有合並單元格的GridView)

[英]how to merge row in one column (GridView with merged cells)

在此處輸入圖片說明

我如何使用C#合並使用asp.net中的圖片的行網格視圖

您可以通過GridView的RowSpan輕松實現。

您可以參考以下鏈接

GridView:創建組和摘要

實施GridView分組:在ASP.Net中將相似的GridView行分組

在ASP.NET Gridview控件中對數據進行分組

希望對您有幫助:)

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM