G
Guest
C#
I have a screen with 2 datagrids on it. The screen is designed for
allocating records from one datagrid to the other. Once a record has moved
from one to the other, i refresh them both to show the change. To do the
refresh though, currently I am sending a request back to the DB to refetch
the records, which can obviously have performance hits.
I have been able to refresh the datagrid which is losing the record, by
creating a new dataset, merging the old data into it, and then removing the
relevant row from this dataset before rebinding the grid to it:
dsData topGridDS = new dsData();
topGridDS.Merge(initialTopDS.Job);
topGridDS.Job.Rows.Remove(topGridDS.Job.FindByJobID(....))
datagrid1.datasource = topGridDS...
....
...
so this refreshes the datagrid that is losing a row, without going back to
the DB to refresh. But how do I do the reverse process, of adding the moved
row into a new dataset? If I use the AddRow method it complains that the row
already belongs to a dataset. I thought maybe I could use the CopyTo method
but I cant work out how to use that either.
Thanks
Steve
I have a screen with 2 datagrids on it. The screen is designed for
allocating records from one datagrid to the other. Once a record has moved
from one to the other, i refresh them both to show the change. To do the
refresh though, currently I am sending a request back to the DB to refetch
the records, which can obviously have performance hits.
I have been able to refresh the datagrid which is losing the record, by
creating a new dataset, merging the old data into it, and then removing the
relevant row from this dataset before rebinding the grid to it:
dsData topGridDS = new dsData();
topGridDS.Merge(initialTopDS.Job);
topGridDS.Job.Rows.Remove(topGridDS.Job.FindByJobID(....))
datagrid1.datasource = topGridDS...
....
...
so this refreshes the datagrid that is losing a row, without going back to
the DB to refresh. But how do I do the reverse process, of adding the moved
row into a new dataset? If I use the AddRow method it complains that the row
already belongs to a dataset. I thought maybe I could use the CopyTo method
but I cant work out how to use that either.
Thanks
Steve