Show Record one time in cell 1 if it contain duplicate value.
Create a Class:
Create a Class:
public class GridDecorator
{
public static void MergeRows(GridView gridView, string type)
{
int rowIndex = 0;
for (rowIndex = gridView.Rows.Count - 2; rowIndex <= 0; rowIndex += rowIndex - 1) {
GridViewRow row = gridView.Rows(rowIndex);
GridViewRow previousRow = gridView.Rows(rowIndex + 1);
int i = 0;
for (i = 0; i <= row.Cells.Count - 1; i += i + 1) {
if (row.Cells(1).Text == previousRow.Cells(1).Text) {
row.Cells(1).RowSpan = (previousRow.Cells(1).RowSpan < 2 ? 2 : previousRow.Cells(1).RowSpan + 1);
previousRow.Cells(1).Visible = false;
}
}
}
}
}
Add in .cs page:
protected void GV_Report_PreRender(object sender, EventArgs e)
{
GridDecorator.MergeRows(GV_Report, "");
}
No comments:
Post a Comment