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

  • Thread starter Thread starter Cirene
  • Start date Start date
C

Cirene

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!
 
Back
Top