Editing a child from collection not in grid...?

Editing a child from collection not in grid...?

Old forum URL: forums.lhotka.net/forums/t/7601.aspx


reagan123 posted on Thursday, September 10, 2009

Hi everyone.

It seems like most of the examples of updating/editing child collections involves direct editing in a grid.  We have a case where our child object contains quite a few fields, some that can have alot of text, that don't really fit into the grid method.

Does anyone here have alternate ways of editing child objects.  If so, I'd like to hear the pattern or approach you have taken on this.

Thanks as always.


rsbaker0 replied on Thursday, September 10, 2009

We have two patterns for doing this that are very similar and differ only in how you select the child for editing.

Basically, your screen has a details area at the bottom for editing the child object fields for the "current" child. Then you need a mechanism for picking which child is currently selected for editing. We have used both a combobox or drop/down list as well as a small grid that contains the list of children available for editing.  As the selection in the combo or grid changes, the details area is synchronized with the selected child.

I'm not a big fan of this, but I was emulating a legacy code implementation. There are some things to look out for, like you need to be sure that the current data is posted to the child before you switch to another.

There may also be binding issues. We manage the edit/undo ourselves (DisableIEditableObject = true), which may let us get by with things that might otherwise break.

 

reagan123 replied on Thursday, September 10, 2009

Thanks for the reply.

That's pretty much the approach we are using at the moment.  I was just trying to see if there were any "smarter" ways to do it.

Thanks again.

rsbaker0 replied on Friday, September 11, 2009

Another approach might be to still use the grid itself, but one with enhanced capabilities that allows more data to be viewed/edited without scrolling. For example, the DevExpress grid has the ability to have rows that span multiple lines (a feature I have used), as well as custom detail panels (which I haven't). The latter capability seems to be the equivalent of having your form embedded directly in the grid, which you can expand or hide at will.

Tom_W replied on Friday, September 11, 2009

The extended grid with custom details panel is the approach we are using for this type of situation.

We're using the Infragistics Winforms controls for this, but currently we are having issues with the grid not retaining layouts at runtime so I wouldn't necessarily recommend the Infragistics components at this point.  That said, I think the issues are possibly down to .net databinding resetting the bindingsource, so it may well not be an Infragistics issue. 

Copyright (c) Marimer LLC