Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Any way to commit changes in datagrid BEFORE changing rows?

Status
Not open for further replies.

millerk

Programmer
Jul 5, 2002
133
US
I have a datagrid that is bound to a dataset.
I have a "Save" button that checks the RowState of each row in the dataset to know whether to update the db or not. I have a "Cancel" button that does a RejectChanges on the dataset. This all works fine.
I want to be able to change the color of the rows that have been modified but not "Saved" yet. I also want to be able to hide the Save and Cancel buttons and only make them visible when something in the datagrid has been changed.

The problem I have is that after you change a value in the datagrid, the dataset doesn't get updated and have it's RowState property changed until after the row is changed. Is there any way to force this to happen as soon as something is typed in the datagrid instead of having to wait until the user moves to the next row or off the control?

I've got the event handlers in place so I'm able to capture the KeyPress event on the textboxes in the datagrid. I just can't seem to find a way to force the datagrid to update the dataset without switching rows.

Any ideas?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top