I have a grid displaying URLS and an ''Add New'' button
When i click the button a new row is added.
Now if i''m editing a row and i click the button, then the grid loses focus which means it saves the current row and then the New button adds a new entry.
I also have the ability to drag in a URL from internet explorer which calls the AddNew() method.
BUT since the focus is not lost on the grid then whatever changes you were making are lost.
So i tried this :
private void AcceptChanges(GridDataBoundGrid grid) {
// if we drag a URL in then the data doesnt get updates unless we do this
DataView dv = (DataView) grid.DataSource;
CurrencyManager cm = (CurrencyManager)this.BindingContext[dv];
cm.EndCurrentEdit();
}
I also tried
private void AcceptChanges(GridDataBoundGrid grid) {
// if we drag a URL in then the data doesnt get updates unless we do this
DataView dv = (DataView) grid.DataSource;
CurrencyManager cm = (CurrencyManager)this.BindingContext[dv];
((DataRowView) cm.Current).Row.AcceptChanges();
}
the currency manager correctly identifies the row i''m editing, but cm.EndCurrentEdit() does not save the data in the row.
How do i do this? There
AD
Administrator
Syncfusion Team
March 31, 2004 08:38 AM UTC
Try first calling grid.CurrenctCell.EndEdit() and then grid.Binder.EndEdit() (or your currencymanager.EndCurrentEdit())
SI
simon
March 31, 2004 01:55 PM UTC
thanks, that did it
is it safe to call these methods if there is no CurrentCell. i got no null reference exception so i assume it is
AD
Administrator
Syncfusion Team
March 31, 2004 02:37 PM UTC
It is OK. The EndEdit method has embbedded checks to avoid problems.