Hello freind, you may try this code:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.RowIndex > 0)
{
int colSpanValue = 2;
for (int i = 0; i < e.Row.Cells.Count - 1; i++)
{
if (e.Row.Cells[i].Text == e.Row.Cells[i + 1].Text)
{
e.Row.Cells[i].ColumnSpan = colSpanValue;
e.Row.Cells[i + 1].Visible = false;
colSpanValue++;
}
}
}
}
}