I have a winform with a radgridview with filtering enabled. The data source is a dataset. The purpose of the form is to make various global updates to a weight column in the database. So for example the user first sets a filter, for example on a specific zipcode, and say that there are 4 rows that meet that condition. Next to the grid I have a text box and a command button. The user inputs the package weight that is for the filtered zip and clicks a submit button. The code then applies the package weight to the filtered records - this works - and all the values for package weight get properly set and are shown in the grid. Then I have a 'save all' button - this is *almost working'. Previously the code I had in the save button click was:
this.tblDISTRIBUTIONACTIVITYBindingSource1.EndEdit();
this.tmcprod1024DataSet1.AcceptChanges();
nretval = this.tblDISTRIBUTIONACTIVITYTableAdapter1.Update(tmcprod1024DataSet1.tblDISTRIBUTIONACTIVITY);
And in this case, the backend data was never updated, no updates whatsoever. However, I then read some online posts and realized that I needed to eliminate the "acceptchanges" line. After I eliminated that line things were *almost correct* but still not there yet. Now, taking the example above with 4 filtered records, when I click the save button, if say for example the third record is highlighted in the grid, then the three non-highlighted records get updated on the backend, but the highlighted record doesn't get updated. Regardless of which row is highlighted at the time of clicking save, the data on the highlighted row doesn't get updated. Can someone please explain what is wrong and how I can fix this? Thanks.
The code that changes the weight value in the grid, upon clicking the command button, is as follows:
foreach (var onerow in radGridView1.ChildRows)
{
double dnumber;
dnumber = Convert.ToDouble(maskedTextBox2.Text);
onerow.Cells["customerratethisorder"].Value = dnumber;
}