You can merge cells in RowDataBound event of GridView. Try this (for your example):
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Cells[1].ColumnSpan = 3;
e.Row.Cells[1].Text = "Code";
e.Row.Cells.RemoveAt(3);
e.Row.Cells.RemoveAt(2);
}
else if (e.Row.RowType == DataControlRowType.DataRow)
{
string cell1 = "," + ((Label)e.Row.FindControl("A2")).Text;
string cell2 = "," + ((Label)e.Row.FindControl("A3")).Text;
e.Row.Cells[1].ColumnSpan = 3;
e.Row.Cells[1].Text = ((Label)e.Row.FindControl("A1")).Text + cell1 + cell2;
e.Row.Cells.RemoveAt(3);
e.Row.Cells.RemoveAt(2);
}
}