BeginEdit EndEdit slow when updating a large number of cells in temporary column

  • Thread starter Thread starter Kurt Kopchik
  • Start date Start date
K

Kurt Kopchik

I have a Windows Forms DataGrid bound to a DataView of a
DataSet. I need to sort the rows in the DataGrid based
off of a custom functions return value.

To do this loop through all of the rows in the DataView
and pass the required information from each row to my
custom function and then I write the value returned by
the function to an additional column which I added to the
DataView.

I can then and sort based off the the values in that
column. The problem is that updating a whole column of
cells in a DataView it is extremely slow (over 10,000
records). I noticed that if I call BeginEdit on each row
before I change each of the cells it updates all of the
values fairly quickly. The calculated values are
displated in the DataGrid but when sorting it still uses
the previous values (Because EndEdit was never called).

The values I calcuate and add to this additional column
do not need to be updated in the database, they are only
used to sort the data for viewing purposes. Is there a
faster or better way to do this?

Is there a way to sort a column using the Proposed values
before EndEdit is called?

Is there some way to add a column to a DataView that can
be freely written to without having the overhead of
calling EndEdit?

Thanks,
Kurt
 
Back
Top