Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
975
UpdateMode Property
posted

Hi;

I'm trying to understand the gird's updateMode property.  If I set the property to OnRowChange, I figured the underlying datasource, in this case an ADO.NET datatable, would be updated only when a different row in the grid is selected.

 So I set up an event handler for my datatable, 

_dsNorthwindEmployees.Tables["Employees"].ColumnChanging += new DataColumnChangeEventHandler(DataTableColChanging);

only to find that the DataTableColChanging(object sender, DataColumnChangeEventArgs e) method fires even when I click in another cell in the same row.  I was expecting to see this fire only when I clicked on another row entirely.

 What am I not understanding?

Thanks,

Bill

 

  • 37774
    Verified Answer
    posted

     Bill,

    What I think might be happening here is that the grid is assigning the value to the underlying DataSource, but isn't actually telling the underlying row to commit the edit process.  Basically, in the case where the underlying data source implements IEditableObject, the grid will call BeginEdit on the row, which tells that row that we're in an atomic edit operation.  When you update cell values in the same row, they will be committed to the underlying row, but EndEdit will not actually be called until you shift focus to another row; EndEdit is what tells the underlying object to commit any changes that we've made since calling BeginEdit.

    -Matt