Sno Date Partyname Meattye Weight Rate Total DCNO 1 26/10 A Chicken 12 150 1800 1546 2 26/10 A Mutton 10 150 1500 1546 3 26/10 A Keema 5 100 500 1547 4 26/10 C Chicken 12 150 1800 1548 5 26/10 D Chicken 12 150 1800 1549 6 26/10 D Beef 10 150 1500 1549
My desired O/P is( Only merge and add #Total Feild based on DCNO) Sno Date Partyname Meattye Weight Rate Total DCNO 1 26/10 A Chicken 12 150 3300 1546 2 26/10 A Mutton 10 150 1546 3 26/10 A Keema 5 100 500 1547 4 26/10 C Chicken 12 150 1800 1548 5 26/10 D Chicken 12 150 1549 6 26/10 D Beef 10 150 3300 1549
protected void GVDCNoConfirm_RowDataBound(object sender, GridViewRowEventArgs e) { var thisRow = e.Row; if (e.Row.RowType == DataControlRowType.DataRow) { for (int rowIndex = GVDCNoConfirm.Rows.Count - 2; rowIndex >= 0; rowIndex--) { GridViewRow gvRow = GVDCNoConfirm.Rows[rowIndex]; GridViewRow gvPreviousRow = GVDCNoConfirm.Rows[rowIndex + 1]; for (int cellCount = 8; cellCount < gvRow.Cells.Count; cellCount++) { if (gvRow.Cells[cellCount].Text == gvPreviousRow.Cells[cellCount].Text) { if (gvPreviousRow.Cells[cellCount].RowSpan < 2) { float currentvalue = 0; currentvalue = Convert.ToSingle(gvRow.Cells[7].Text); gvRow.Cells[7].Text = Convert.ToString(currentvalue + Convert.ToSingle(gvPreviousRow.Cells[7].Text)); gvRow.Cells[cellCount].RowSpan = 2; gvRow.Cells[7].RowSpan =2; } else { gvRow.Cells[cellCount].RowSpan = gvPreviousRow.Cells[cellCount].RowSpan + 1; gvRow.Cells[7].RowSpan = gvPreviousRow.Cells[7].RowSpan + 1; } gvPreviousRow.Cells[cellCount].Visible = false; gvPreviousRow.Cells[7].Visible = false; } } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)