DevExpress grid, new row, misses first letter on edit


Author
Message
George Nentidis
George Nentidis
StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 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?

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K 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.

Chan
Chan
Advanced StrataFrame User (737 reputation)Advanced StrataFrame User (737 reputation)Advanced StrataFrame User (737 reputation)Advanced StrataFrame User (737 reputation)Advanced StrataFrame User (737 reputation)Advanced StrataFrame User (737 reputation)Advanced StrataFrame User (737 reputation)Advanced StrataFrame User (737 reputation)Advanced StrataFrame User (737 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

I was facing the same problem. After long time investigation from DevExpress and SF team, I give up to use new row in XtraGrid with SF BBS.



I have posted this to SF team but haven't get any reply.



However, according to DevExpress team (I sent them sample project, and they tried using SF trial version) the way of SF BBS binding is a bit weird for them which is not compatible with xtragrid. They provided some workaround but cause another problem. At last, they recommend me to not use new row.
George Nentidis
George Nentidis
StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)
Group: Forum Members
Posts: 72, Visits: 251
Thank you Chan.

Do you remember what the workaround was?

George Nentidis
George Nentidis
StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)
Group: Forum Members
Posts: 72, Visits: 251
Trend,

The PropertyChanged, etc. options are in the DataBinding collection of controls. The grid does not work with DataBindings collection, so I can't use it.

Also the BusinessBindingSource does nothing different than my code. The DataGridView works fine. The problem only happens with DevExpress grid. But then again if DataGridView was enough nobody whould need DevExpress...

Have you tried a BusinessBindingSource sample using DevExpress grid?

Chan
Chan
Advanced StrataFrame User (737 reputation)Advanced StrataFrame User (737 reputation)Advanced StrataFrame User (737 reputation)Advanced StrataFrame User (737 reputation)Advanced StrataFrame User (737 reputation)Advanced StrataFrame User (737 reputation)Advanced StrataFrame User (737 reputation)Advanced StrataFrame User (737 reputation)Advanced StrataFrame User (737 reputation)
Group: Forum Members
Posts: 533, Visits: 2K
Hi,

Hope this help



http://www.devexpress.com/Support/Center/p/CQ57816.aspx



Unbound column and new item row
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
But then again if DataGridView was enough nobody whould need DevExpress...

I was not suggesting that you use this control...I was trying to identify where your problem was.  Also, this control does far more than you may give it credit for.  Infragistics UltraGrid actually inherits off of this control and then implements all of their logic...so if you have the time and patience, you can do a lot with the DataGridView.

Have you tried a BusinessBindingSource sample using DevExpress grid?

Yes, and it works without issue.  I suggest that you create a small sample that reproduces your problem and post it here on the forum so I can take a look.

George Nentidis
George Nentidis
StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)
Group: Forum Members
Posts: 72, Visits: 251
Trent

I had no intention of affending anyone. But I want you to be sure that before I post anything in the forum, I try a lot to make it work. I know that your time (as everyone's) is valuable.

The minute I have some time I will send you a sample.

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
George, if I offended you that was not my intention.  I can tell through our interation thus far that you are a solid developer and I know that you attempted to work the problem.  The reason I suggested a quick sample is because this is a control that a lot of our developers use out there and I would be curious to see why it might be failing.  Hope this helps your understand where I was coming from Smile
George Nentidis
George Nentidis
StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)StrataFrame User (136 reputation)
Group: Forum Members
Posts: 72, Visits: 251
Trent,

Here's the sample I promised you.

I have taken the BusinessBindingSource sample and added a DevExpress grid on the form. The only thing I changed on the grid is the NewItemRowPosition.

Now try to add a new row by typing directly to grid's NewRow added at the bottom of the grid. You will see that the first character you type will be lost. This happen when I set default values in CustomersBO in the CustomersBO_SetDefaultValues event. Remove or comment the line

this.cust_Email = "someone@somewhere.com";

and all will work fine.

Also placing the CurrentRow.BeginEdit just before the assigment seem to fix the problem, but not when you add the first row in an empty BO.

this.CurrentRow.BeginEdit();
this.cust_Email = "
someone@somewhere.com";

I hope all these can help you fix it quickly (next build for instance BigGrin).

Thank you

Attachments
BusinessBindingSource.rar (103 views, 645.00 KB)
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