DataGrid Updating DataSource

  • Thread starter Thread starter John zink
  • Start date Start date
J

John zink

I have a datagrid that displays a few columns from a table.
I need to be able to update a process date on each row if
any of the displayed columns get updated. The process
date ("UPDT_DT") is not in the datagrid. I put an event
handler on the textboxes in the grid so I can capture when
a change occurs, but I can't seem to get the process date
column updated.
Here is the code I tried:
CType
(Me.BindingContextdgLists.DataSource, "UW_LISTS").Current,
DataRowView).Row.Item("UPDT_DT") = Date.Now

The line of code executes but when "UPDT_DT" is updated it
resets the row in the data grid.

Any ideas of how to accomplish this task ?
 
Hi John,

First of all, this piece looks a little bit "alien" to me:
Me.BindingContextdgLists.DataSource

I'd suggest to ensure that the right source is referenced by this property -
just to be safe.

Second, you might try to call AcceptChanges on a row after the
ProcessingDate gets updated. The reason is that the grid's binding manager
could just roll back your change when data grid pushes updated data back to
the data source.

Third, you may try to handle DataView's ListChanged event instead and react
on ItemChanged notifications.
 
Back
Top