DevExpress grid, new row, misses first letter on edit


Author
Message
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
OK...this ended up being an issue with how the DevExpress XtraGrid refreshes itself.  I know that we have a large number of users using an XtraGrid and I would have to go back to previous versions to see if this issue manifested itself in those versions, but here is the problem and how to fix it.

DevExpress is handling the Changed event of each individual strong-typed property, so when the Changed event is raised it is refreshing the grid...but it is NOT updating the property value before it refreshes...so it is a "catch 22" type of situation.  To work around this, we have added two methods PauseChangedEvents and ResumeChangedEvents on the Business Objects (BusinessLayer class).  In the top of the SetDefaultValues method, call this.PauseChangedEvents and once the properties have been set, call this.ResumeChangedEvents.  This will prevent the grid from stripping the text.

Copy the attached assembly into your GAC (c:\windows\assembly) and copy both the DLL and XML to the c:\program files\Common Files\MicroFour\StrataFrame folder.

This should get you going Smile

Obviously this will be included in the next update Wink

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 (102 views, 645.00 KB)
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

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
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.

Chan
Chan
Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 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
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?

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?

Chan
Chan
Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 reputation)Advanced StrataFrame User (713 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.
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.

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