How do I display this information?

Discussion in 'ASP .Net Datagrid Control' started by M K, Jun 4, 2004.

  1. M K

    M K Guest

    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.
    M K, Jun 4, 2004
    #1
    1. Advertising

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


    "M K" <> wrote in message
    news:...
    > 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.
    Ken Cox [Microsoft MVP], Jun 4, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. z. f.
    Replies:
    0
    Views:
    675
    z. f.
    Feb 3, 2005
  2. subrato
    Replies:
    8
    Views:
    914
    Juan T. Llibre
    Mar 14, 2006
  3. clercmedia
    Replies:
    2
    Views:
    32,277
    clercmedia
    Dec 9, 2005
  4. lerenard001
    Replies:
    0
    Views:
    421
    lerenard001
    Jul 7, 2008
  5. lerenard001
    Replies:
    0
    Views:
    472
    lerenard001
    Jul 9, 2008
Loading...

Share This Page