That sounds like a job for Denis Bauer's free HierarGrid!
"I have created a custom control called HierarGrid that derives from the
DataGrid and a custom DataGridColumn called HierarColumn.
The HierarGrid takes a DataSet that contains relations between the tables.
While iterating over the parent table it checks the related tables for child
rows and if one is found it dynamically loads a template for the child
row(s).
The template is rendered invisibly into the custom HierarColumn and when the
user clicks the plus icon, the template content is copied via JavaScript
into a newly created TableRow."
http://www.denisbauer.com/ASPNETCont...ierarGrid.aspx
"M K" <> wrote in message
news:52432EDB-96F0-4881-97B4-...
> Okay, I have a ShoppingCartDetails table. The shopping cart lists
> photographic prints. There may be one image with more than one line item,
> or more than one print size. For example:
>
> CartDetailID ProductID Qty PhotoID...
> 1 5x7 2 0003
> 2 4x5 4 0003
>
> Now, there may also be a line item for a product that requires more than
> one image. In which case, those images are in a second table, linked by
> the CartDetailID:
>
> CartDetailID ProductID Qty PhotoID...
> 3 PhotoCube 2
>
> AddPhotoID CartDetailID PhotoID...
> 1 3 0004
> 2 3 0005
> 3 3 0006
> 4 3 0007
> 5 3 0008
>
> So I'd like my datagrid to do something like this:
>
> Photo Products Qty Total
> ---------------------------------------
> 0003 5x7 2 $2.99
> 4x5 4 $3.75
> ---------------------------------------
> 0004 PhotoCube 2 $12.99
> 0005
> 0006
> 0007
> 0008
>
> Am I nuts? Any ideas? I could probably do two queries, one for line items
> with a PhotoID and then group the Products by that PhotoID (DataView or
> something) and another query for line items without a PhotoID which would
> then get a group of PhotoIDs from the second table. But I wanted to know
> if there was anybody with a good idea.