what is your exact purpose for creating dynamical row? To display some picture?
as I know it is easy to dynamially create the row, but not easy to maintainance. I have similar experience. My purpose of creating dynamical row is to insert a blank row without height below some special rows to highlight them, however, it will completely change after postback. My solution is changing the style of the row instead of inserting a new row.
private void InsertSummaryRow(GridView gv, int rowIndex,int colSpan, int HLfontSize)
{
Label Summary0 = new Label();
Summary0.Text = "Summary:";
Summary0.Font.Size = HLfontSize; Summary0.ForeColor = System.Drawing.Color.FromName("MediumBlue"); Summary0.Height = Unit.Parse("20px");
GridViewRow tr = new GridViewRow(0, 0, DataControlRowType.EmptyDataRow, DataControlRowState.Normal);
TableCell cel = new TableCell();
cel.ColumnSpan = colSpan;
cel.Style.Add("border-bottom", "blue 3px solid"); cel.Style.Add("white-space", "nowrap"); cel.Controls.Add(Summary0);
tr.Cells.Add(cel);
gv.Controls[0].Controls.AddAt(rowIndex, tr);
}