public class GridDecorator { public static void MergeRows(DataGrid gridView) { for (int rowIndex = gridView.Items.Count - 2; rowIndex >= 0; rowIndex--) { DataGridItem row = gridView.Items[rowIndex]; DataGridItem previousRow = gridView.Items[rowIndex + 1]; for (int i = 0; i < row.Cells.Count; i++) { if (row.Cells[i].Text == previousRow.Cells[i].Text) { row.Cells[i].RowSpan = eviousRow.Cells[i].RowSpan < 2 ? 2 : previousRow.Cells[i].RowSpan + 1; previousRow.Cells[i].Visible = false; } } } } } < protected void grdEmployee_PreRender(object sender, System.EventArgs e) { GridDecorator.MergeRows(grdEmployee); }
[IMG]https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpf1/v/t34.0-12/10807134_1510073735912771_856276471_n.jpg?oh=29fcc9f370dd003c51e4dbfbe6561d86&oe=54685F39&p;__gda__=1416058857_e0a47d165095e8a4bcd42da7f130cd59[/IMG] When I Merge [IMG]https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpa1/v/t34.0-12/10806900_1510073739246104_499714655_n.jpg?oh=b3ed3642b9a81f58d0d559ce07d6391e&oe=54685201&__gda__=1416056865_b6901eff324666d9d24d856071823026[/IMG] But I'd like as shown below [IMG]https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpf1/v/t34.0-12/974437_1510073725912772_949911600_n.jpg?oh=8a524564736a3d7b9e5d8d45455cb7de&oe=54674667&__gda__=1416058362_a84fe8a375c2a571e1edd0fb1705762b[/IMG]
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)