Add 1 new row for each row and then update all the records, but Why it JUST Update 1 / 2 records of Gridview?
<p>I add 1 new row for each row in a GridView and then update all the records, but it only updates 1 / 2 records of GridView? Can anybody help me?</p>

<p>This is my code:
1, Add new row for or each row in GridView</p>

<pre><code>protected void gvUsersL_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    { 
        GridViewRow g = new GridViewRow(-1, -1, DataControlRowType.DataRow, DataControlRowState.Normal);

        //creating table Cells
        TableCell tCell = new TableCell();
        tCell.Text = table;

        //Add Cells
        g.Cells.Add(tCell);
        tCell.ColumnSpan = e.Row.Cells.Count;

        //Set Color for Empty Cell
        g.CssClass = "bgi_1";
        Table tbl = e.Row.Parent as Table;

        //add rows
        tbl.Rows.Add(g);
    }
}
</code></pre>

<p>2, Then Update:</p>

<pre><code>for (int i = 0; i &lt; gvUsersL.Rows.Count; i++)
{
    //update here
}
</code></pre>

<p>Can any body help me? Thanks. </p>
