Read Gridview exact rows after adding a dynamically added header?
<p>I am adding a table header row dynamically as shown below. It is rendered correctly.
So now I have 2 headers.</p>

<pre><code>protected void gvCustomers_RowDataBound(object sender, GridViewRowEventArgs e)
</code></pre>

<p>{</p>

<pre><code>if (e.Row.RowType == DataControlRowType.Header)
{
    GridViewRow newHeaderRow = new GridViewRow(-1, -1, DataControlRowType.Header, DataControlRowState.Normal);

    TableCell cell1 = new TableHeaderCell();
    cell1.ColumnSpan = 1; //e.Row.Cells.Count;
    cell1.Text = "Expected";

    TableCell cell2 = new TableCell();
    cell2.ColumnSpan = 2;
    cell2.Text = "One";

    TableCell cell3 = new TableCell();
    cell3.ColumnSpan = 2;
    cell3.Text = "Two";

    TableCell cell4 = new TableCell();
    cell4.ColumnSpan = 2;
    cell4.Text = "Three";

    newHeaderRow.Cells.Add(cell1);
    newHeaderRow.Cells.Add(cell2);
    newHeaderRow.Cells.Add(cell3);
    newHeaderRow.Cells.Add(cell4);

    ((GridView)sender).Controls[0].Controls.AddAt(0, newHeaderRow);
}
</code></pre>

<p>}</p>

<p>If my gridview is having 3 rows, and loop through gridview it will read only 2 row.
It is skiping the last row.</p>

<p>Any thoughts</p>
