locked
merge similar data together RRS feed

  • Question

  • i am trying to merge similar data together but choosen data. for example the table has 5 rows and i want 3 rows which have similar data to merge. other 2 rows, even though it contains similar data, i dont want it to merge. is there a way to do this? here is my current code:
            protected void DataBoundModuleGV(object sender, EventArgs e)
            {
                for (int rowIndex = ModuleGV.Rows.Count - 2; rowIndex >= 0; rowIndex--)
                {
                    GridViewRow gvCurrRow = ModuleGV.Rows[rowIndex];
                    GridViewRow gvPrevRow = ModuleGV.Rows[rowIndex + 1];
                    for (int cellCount = 0; cellCount < gvCurrRow.Cells.Count; cellCount++)
                    {
                        if (gvCurrRow.Cells[cellCount].Text == gvPrevRow.Cells[cellCount].Text)
                        {
                            if (gvPrevRow.Cells[cellCount].RowSpan < 2)
                            {
                                gvCurrRow.Cells[cellCount].RowSpan = 2;
                            }
                            else
                            {
                                gvCurrRow.Cells[cellCount].RowSpan = gvPrevRow.Cells[cellCount].RowSpan + 1;
                            }
                            gvPrevRow.Cells[cellCount].Visible = false;
                        }
                    }
                }
            }

    • Moved by Chao Kuo Wednesday, November 18, 2009 9:19 AM (From:Visual C# General)
    Tuesday, November 17, 2009 7:57 AM

Answers

  • Hi,
    this is not a forum for webapplication related post.
    you need to go for http://forums.asp.net/
    hope it helps.
    Best Regards, C.Gnanadurai ----------------------- Please mark the post as answer if it is helpfull to you
    • Marked as answer by Chao Kuo Wednesday, November 18, 2009 9:18 AM
    Tuesday, November 17, 2009 8:07 AM