This is part of our ongoing dynamic row creation in Repeater.
By default, the first row is available.
After filling in data into the cells of the first row, user clicks the Add New Row button to add another row.
This part works fine.
The issue is that whether user enters one row or several rows, when you submit the data to the database, only one row of data is saved.
Here is the code that I am using.
Any ideas how to modify this so that no matter how many rows are created in the markup, those rows are saved to the database.
Thanks in advance.
foreach (DataRow row in table.Rows)
string txBoatRegNum = row.ItemArray as string;
string txTaxPayerRet = row.ItemArray as string;
if (txBoatRegNum != null & txTaxPayerRet != null)
txTaxPayerRet = "0";
SqlCommand aircmd = new SqlCommand("sp_savetInfo", conn);
aircmd.CommandType = CommandType.StoredProcedure;
aircmd.Parameters.Add("@txretval", SqlDbType.Money).Value = decimal.Parse(txTaxPayerRet);
lblResult.ForeColor = System.Drawing.Color.Green;
lblResult.Text = "Thank you! <br>You have successfully completed the form.";
lblResult.ForeColor = System.Drawing.Color.Red;
lblResult.Text = "Your form failed to save, please try again.";