Gridview editing, IsDirty and Save

Gridview editing, IsDirty and Save

Old forum URL: forums.lhotka.net/forums/t/2860.aspx


Mahmud posted on Saturday, May 12, 2007

The secnario is -

(1) A GridView is bound with a BusinessListBase class with two fields

(2) For better user experience, we have the Save button bound with IsDirty of the businesslistbase object, so that Save button is enabled when object is dirty (ready to be saved).

(3) But due to GridView default behaviour, let say the user edits a field in a record...and does not move from the line...object does not become dirty and save is not enabled. I know this is the default behaviour... But as we implemented in VB6 in our old software, users want Save to be enabled as soon as any editing is done in GridView.

Which event or method should we use to do this? Every control does have one OnPropertyChanged behaviour...but for the controls embeddedinside the gridview...I cannot find the property anywhere...

Help is requested from experts.

Brian Criswell replied on Saturday, May 12, 2007

You can check to see if the grid databinding supports updating on the value changing instead of on the control validating.  This is available on the single controls (textbox, checkbox, etc.), but I do not know about the GridView.

Mahmud replied on Monday, May 14, 2007

I could not find the DataBindings property of the bound controls in the gridview. When I tried to access the property, it throws an exception. No luck.

NickTower replied on Tuesday, May 15, 2007

In a gridview, the only thing that I've found is I hit the [ENTER] key, which forces the edit to be accepted, before I click save.  I don't know any other way either!!

Mahmud replied on Thursday, May 17, 2007

After searching through windowsforms.net forums - I found a solution. Two things you have to use -

gridview CurrentCellDirtyStateChanged event &

gridview.IsCurrentCellDirty property

 

 

 

 

Copyright (c) Marimer LLC