Auto-set DataTable field value when row is changed RRS feed

  • Question

  • I'm trying to set the value of a specific field whenever the user inserts or edits a row. First I tried the RowChanging event, but that won't let me change data. Then I tried the RowChanged event -- that didn't give me an error, but it also didn't change the data.

    Can someone tell me the proper way to do this? I suppose it's possible that the data is actually getting changed, but the Dev Express grid I'm using perhaps doesn't show the change? In any case, help would be appreciated.


    Wednesday, November 14, 2007 3:10 AM

All replies

  • You could create column with Expression and data will be updated in your DataTable in this case. Check Expression property of the DataColumn for it. But updating grid is totally different issue. In many cases you need to refresh controls (or rebind them) to be able to reflect new information from underlying data source.


    Wednesday, November 14, 2007 11:29 AM
  • Thanks for the reply. I don't think an Expression is what I want, because this doesn't actually change the value in the column, right? As an example of what I want to do, I want to change the "LastUpdatedBy" to the user's ID when they add or change a row.

    Correction to my initial post. When I try to change the value in the RowChanged event, I get stuck in a loop.

    Any other ideas?

    Wednesday, November 14, 2007 1:06 PM