<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False"
Width="696px" OnDataBound="OnDataBound">
protected void OnDataBound(object sender, EventArgs e)
{
for (int i = GridView2.Rows.Count - 1; i > 0; i--)
{
GridViewRow row = GridView2.Rows[i];
GridViewRow previousRow = GridView2.Rows[i - 1];
if (row.Cells[0].Text == previousRow.Cells[0].Text)
{
if (previousRow.Cells[0].RowSpan == 0)
{
if (row.Cells[0].RowSpan == 0)
{
previousRow.Cells[0].RowSpan += 2;
}
else
{
previousRow.Cells[0].RowSpan = row.Cells[0].RowSpan + 1;
}
row.Cells[0].Visible = false;
}
}
}
}
Width="696px" OnDataBound="OnDataBound">
protected void OnDataBound(object sender, EventArgs e)
{
for (int i = GridView2.Rows.Count - 1; i > 0; i--)
{
GridViewRow row = GridView2.Rows[i];
GridViewRow previousRow = GridView2.Rows[i - 1];
if (row.Cells[0].Text == previousRow.Cells[0].Text)
{
if (previousRow.Cells[0].RowSpan == 0)
{
if (row.Cells[0].RowSpan == 0)
{
previousRow.Cells[0].RowSpan += 2;
}
else
{
previousRow.Cells[0].RowSpan = row.Cells[0].RowSpan + 1;
}
row.Cells[0].Visible = false;
}
}
}
}