I am trying to enable editing for multiple columns in my DataGridView. Now, before any suggestions, I should read the MSDN article : How to: Set the editing mode for the Windows Forms DataGridView control , I already have it.
In conclusion (and quote):
- The main data source supports editing.
- The DataGridView control is enabled.
- The value of the EditMode property is not EditProgrammatically.
- The ReadOnly properties of the cell, row, column, and control are set to false.
All this is simple and common sense. I confirmed that Enabled = true . I confirmed that EditMode is EditOnKeystrokeOrF2 I confirmed that all columns (except one) are ReadOnly = false .
What interests me is the first line: -
The main data source supports editing.
Now, I do the following: bind data to DGV: -
// Grab all the Foos. var foos = (from x in MyRepository.Find() select new { x.Foo1, x.Foo2, ... x.FooN }).ToList(); // Now lets bind this result to the GridView. dataGridView2.DataSource = foos;
I thought this was the right way to do something.
What I planned to do was when the cell was changed, and the user left the cell where I planned to capture the data that had just been changed (this can be seen manually), and then manually update the database.
Is this right to do?
source share