I'm using DevExpress XtraGrid (8.2.1) in my windows-application and am having some problems with child-collections. Editing is working just fine, but when adding a new child to the childcollection using the 'NewItemRowPosition' so the new record will be inserted by the grid, strange things happen, the first keystroke (or selected date in dateEdit) is discarded, while adding items in a similar fashion to a EditableRootCollection works just fine.
I was just wondering if anyone here had maybe solved this problem already, so I won't have to. " src="/emoticons/emotion-2.gif">
I just started testing xtrgrid for my new project.
Would be interested to know all the sharp edges that you may have using the component.:)
TIA = Thanks In Advance.... :-)
I have subclassed all DevExpress controls that I use in my project, which is (I think) a good way to get uniformity on controls within a project. Except for the problem as explained in my message I'm not encountering any real problems, I find that it works just fine.
I just learned a new acronym today! :)
I just love their GUI. Their skinning looks and feels UI feature just rocks.
One question, where did purchase your dx component.
I notice componentsource offers a cheaper deal.
Not sure I will get the same support level for it.
Tks for the tip.
Well, as it turns out the problem was not with Devexpress controls and also no with Csla but with code in my subclasses wich inherit from csla. When adding a child to my childcollection I set the foreign key to the parent during the AddNewCore(), here the value for property fkOrderId is set, wich raises the propertychanged event, when this 'SetForeignKey' code is commented out, the problem goes away.
Is this a master-detail grid editing scenario? We use the DevExpress suite also -- I'm just trying to envision the particular U/I design that is leading to your problem.
In our case, the XtraGrid works great with an editable root, but if that root has children and you use a master-detail grid, the ERLB saves the root item when you click on a child row, effectively orphaning the child items. We haven't solved this and so don't use this feature except for read-only scenarious.
No it's not. It's a root object with a child collection, only the child-collection is bound to the XtraGrid.
But it's working fine now..
In your scenario, what type of datatype do you use for your keys, Guid or Int ?
I use guids, and when a new child is created I call a method called 'SetForeignKey(businessobject parent)' on the child, thereby setting it's foreign key to the parent, that way, when the child-collection is saved, no 'orphans' are created. If you use Int as foreign key, then you should call Setforeignkey on new children after you've saved the parent and know what the Int value the database assigned to the Primary Key or ID-field, so it can be assigned to the foreign key field of the children.
I think this should also work in a Master-Detail grid.
My keys are int (autonumbering in various flavors, from sequences in Oracle, IDENTITY in SQL Server, autonumber in Access).
I'm currently using CSLA 3.0.x, and since I'm responsible for doing all the child object saving in this version of CSLA (at least I think that is the case ;) , I was setting the parent foreign key of child objects when the parent object is saved. Each BO saves itself first, then traverses child objects and saves them if they are new/dirty and updates their parent foreign key value automatically.
For a child list, I wasn't using an editable root list but instead a BusinessListBase derived class, so the grid shouldn't "save" those objects.
Copyright (c) Marimer LLC