for (int rowIndex = GVDCNoConfirm.Rows.Count - 2; rowIndex >= 0; rowIndex--) { GridViewRow currentRow = GVDCNoConfirm.Rows[rowIndex]; GridViewRow previousRow = GVDCNoConfirm.Rows[rowIndex + 1]; for (int i = 0; i < currentRow.Cells.Count; i++) { if (currentRow.Cells[i].Text == previousRow.Cells[i].Text) { if (previousRow.Cells[i].RowSpan < 2) currentRow.Cells[i].RowSpan = 2; else currentRow.Cells[i].RowSpan = previousRow.Cells[i].RowSpan + 1; previousRow.Cells[i].Visible = false; } if (row.Cells[6].Text == previousRow.Cells[6].Text) { float currentvalue = 0; currentvalue = Convert.ToSingle(row.Cells[5].Text); float previousvalue = currentvalue + Convert.ToSingle(previousRow.Cells[5].Text); row.Cells[5].Text = Convert.ToString(previousvalue); previousRow.Cells[j].Visible = false; } } }
sno name amount dcno 1 xxx 5000 888 2500 1000 1001 2 yyy 5250 1002 2000 555 1250 555
sno name amount dcno 1 xxx 7500 888 1000 1001 2 yyy 5250 1002 3250 555
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)