I have a scenario on a form where I need to save all the rows in the form to a collection in memory to save any changes a user has made prior to saving them to a database, but still allow them to swap between different views.
I'm using the SelectionChanged event to handle storing the data, but I have found that calling GridView.Rows.CopyTo() doesn't work. I get a GridViewDataRowInfo[] array that is populated with null values.
Sample code is below:
this gives me an array populate with null values.
is there a preferred way to accomplish what I am trying to do?
I'm using the SelectionChanged event to handle storing the data, but I have found that calling GridView.Rows.CopyTo() doesn't work. I get a GridViewDataRowInfo[] array that is populated with null values.
Sample code is below:
_batchTrays = new Dictionary<int, GridViewDataRowInfo[]>();
int batchNumber = Convert.ToInt32(grid.CurrentRow.Cells["BatchNumber"].Value);
_batchTrays[batchNumber] = new GridViewDataRowInfo[batchTraysGrid.Rows.Count];
batchTraysGrid.Rows.CopyTo(_batchTrays[batchNumber], 0);
int batchNumber = Convert.ToInt32(grid.CurrentRow.Cells["BatchNumber"].Value);
_batchTrays[batchNumber] = new GridViewDataRowInfo[batchTraysGrid.Rows.Count];
batchTraysGrid.Rows.CopyTo(_batchTrays[batchNumber], 0);
this gives me an array populate with null values.
is there a preferred way to accomplish what I am trying to do?