Question: Gridview question (displaying data from a related "many" table)

Discussion in 'ASP .Net' started by Cirene, Nov 14, 2007.

  1. Cirene

    Cirene Guest

    I have a gridview that displays a listing of cars for sale. It's based on a
    "Cars" table.

    (The "Cars" table has a 1 to many relationship to "CarPictures" table.)

    On each gridview row (ie for each car) I want to show just 1 picture from
    the "CarPictures" table.

    Any suggestions as to how to do this?

    I was thinking of selecting the TOP 1 picture from CarPictures table where
    the CarId is a match and sticking the picture in a databound formview
    control, but I didn't know how to query based on the current gridview row
    (for each row).

    Thanks!
     
    Cirene, Nov 14, 2007
    #1
    1. Advertising

  2. Cirene

    Cirene Guest

    Anyone?

    "Cirene" <> wrote in message
    news:%...
    >I have a gridview that displays a listing of cars for sale. It's based on
    >a "Cars" table.
    >
    > (The "Cars" table has a 1 to many relationship to "CarPictures" table.)
    >
    > On each gridview row (ie for each car) I want to show just 1 picture from
    > the "CarPictures" table.
    >
    > Any suggestions as to how to do this?
    >
    > I was thinking of selecting the TOP 1 picture from CarPictures table where
    > the CarId is a match and sticking the picture in a databound formview
    > control, but I didn't know how to query based on the current gridview row
    > (for each row).
    >
    > Thanks!
    >
     
    Cirene, Nov 15, 2007
    #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. Ken Cox [Microsoft MVP]

    Displaying one-to-many data on web form page

    Ken Cox [Microsoft MVP], Apr 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    616
    Charlie@CBFC
    Apr 29, 2004
  2. .Net Sports

    datagrid not displaying data table data

    .Net Sports, Aug 30, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    2,810
    .Net Sports
    Aug 31, 2005
  3. Rio
    Replies:
    4
    Views:
    1,241
  4. Maxwell Hammer
    Replies:
    7
    Views:
    669
    Peter Hansen
    Jun 18, 2005
  5. Jim Thomason
    Replies:
    3
    Views:
    176
    Topmind
    Oct 2, 2004
Loading...

Share This Page