I need to duplicate the selected row on the grid 1-N times. The duplicates will appear below the selected row. The grid is bound to a datatable in a dataset. The only way I've figured to do this is:
for (int i = 0; i <number of duplicates>; i++)
Datarow dr = datatablename.NewRow();
dr.ItemArray = datatablename.Rows[<position of row in grid to duplicate>].ItemArray;
datatablename.Rows.InsertAt(dr, <position of row in grid to duplicate> + 1);
dr = null;
Is this the correct way to duplicate rows?