Saving changes in datagrid with one row.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a datagrid with just one row. When I edit the contents of the datagrid and click on Save button (somewhere else in the form), the changes are lost. However, if I click TAB from the editable column of the datagrid, the changes are saved. Is there a way to save the changes without clicking TAB button ?
 
Hi,

Two steps are required:

1. Call EndEdit on the DataGrid passing "false" as the "shouldAbort"
argument value
2. Call EndCurrentEdit on the currency manager serving this grid. The
currency manager can be obtained like this:

CurrencyManager cm =
(CurrencyManager)this.BindingContext[dataGrid.DataSource,
dataGrid.DataMember];

Sangeetha. said:
I have a datagrid with just one row. When I edit the contents of the
datagrid and click on Save button (somewhere else in the form), the changes
are lost. However, if I click TAB from the editable column of the datagrid,
the changes are saved. Is there a way to save the changes without clicking
TAB button ?
 
Dmitry,

I am facing the same problem.
one thing I dont understand -
the EndEdit method requires a column and a row number - is there a way to
EndEdit on the whole datagrid?

thanx

Picho

Dmitriy Lapshin said:
Hi,

Two steps are required:

1. Call EndEdit on the DataGrid passing "false" as the "shouldAbort"
argument value
2. Call EndCurrentEdit on the currency manager serving this grid. The
currency manager can be obtained like this:

CurrencyManager cm =
(CurrencyManager)this.BindingContext[dataGrid.DataSource,
dataGrid.DataMember];

Sangeetha. said:
I have a datagrid with just one row. When I edit the contents of the
datagrid and click on Save button (somewhere else in the form), the changes
are lost. However, if I click TAB from the editable column of the datagrid,
the changes are saved. Is there a way to save the changes without clicking
TAB button ?
 
Not sure - but you can easily obtain the two through the CurrentCell (or
something similar) property.
Or, would Mr. Sangheeta be so kind to post his code snippet here? ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top