How do I display this information?

M

M K

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 000
2 4x5 4 000

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 000
2 3 000
3 3 000
4 3 000
5 3 000

So I'd like my datagrid to do something like this

Photo Products Qty Tota
--------------------------------------
0003 5x7 2 $2.9
4x5 4 $3.7
--------------------------------------
0004 PhotoCube 2 $12.9
000
000
000
000

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

Ken Cox [Microsoft MVP]

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/ASPNETControls/HierarGrid.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top