DevExpress grid, new row, misses first letter on edit


Author
Message
George Nentidis
George Nentidis
StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)StrataFrame User (168 reputation)
Group: Forum Members
Posts: 72, Visits: 251
Hi

This is another thing I came on today.

I use DevExpres grid and BusinessBindingSource to edit a BO. DevExpress grid has an empty row, that is used for inserting new rows in the grid. When trying to insert a new row, I click on the grid's empty row and type something in. The first character I type is always lost. Then the cell leaves edit mode, and then I type again and everything works fine. But the first character is always lost. For instance if I try to type "George" the actuall thing that the cell will contain is "eorge". And this only happens when I set default values on the BO_SetDefaultValues event handler. If the handler is empty, all work fine.

My SetDefaultValues handler is:

private void ContactBO_SetDefaultValues()
{
  
this.ContactID = Guid.NewGuid();
  this.ContactType = 3;
}

But, when I make a BeginEdit in the current row:

private void ContactBO_SetDefaultValues()
{
  this.CurrentRow.BeginEdit();
  this.ContactID = Guid.NewGuid();
  this.ContactType = 3;
}

then all work fine when inserting new row in a grid which has some rows already. When I try to insert a new row in a grid with no rows at all, the same thing still happens. The first character I type is lost.

I have tried to set default values, on the OnAfterAddNew, OnBeforeAddNew, OnEditingStateChanged events, nut still the same thing happens.

Has anyone seen that before?

Reply
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Yes.  This is generally due to how the binding is being updated.  This is most common when the binding property is set to update the source on the Validated versus the PropertyChanged event.  You might check your bindings and set this to update your bound property on the PropertyChanged event to see if you have a different result.

One other thing to look at may be the BusinessBindingSource sample that comes with the framework.  You might "compare notes" to see if there is something missing.  Finally, you might see if you have the same problem with a DataGridView instead of the DevExpress grid so that you know you are having the same behavior accross the board and this is not related specifically to the DevExpress grid.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search