By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,538 Members | 2,225 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,538 IT Pros & Developers. It's quick & easy.

Data Web Controls & Join SQL Queries

P: n/a
I'd like to know if there is a best approach, in terms of using the Data Web
Controls (i.e. DataGrid, DataList & Repeater), for displaying data that is
the result of a query that joins two tables that have a one-to-many
relationship. For instance if I perform a query on two such tables, I might
expect that there would be data repeated on multiple rows from table on the
one side of the relationship. What I want to do is display an HTML table
row, or something similar, (using one of the Data Web Controls) on a web
page for each "group". A group being the set of rows that has the same
repeated data (dictated by the join).

For example, I might have a Company table and an Employee table. If I do a
query joining these two (assuming some design decisions here), I'd have
company data repeated in many rows for each employee that works for that
company. I'd like to display the data in a row-based design on a web page
that, for each display row, has the company data once and then the employee
data for each employee that works for that company. So, the display would
be (conceptually) something like this:

ACME Works Ltd. New York, NY

John Doe - hired: 7/8/1986
Jane Smith - hired: 9/1/2004
Bob Harris - hired: 3/5/2002

---------------------------------------------

ABC Company Inc. San Diego, CA

Bob Smith - hired: 3/7/1999
Judy Davis - hired: 3/9/2002
John Roberts - hired: 2/3/2004

---------------------------------------------

.....

So, each "visual row" is really comprised of multiple records in the query's
result set. This is where my confusion comes in. Most of the example I
have seen with the Data Web Controls seem to have a one-to-one relationship
between a record from a query and a "visual row". There may be some
treatment of the data (i.e. change the color, make it a link), but I haven't
specifically seen an example of what I want to do. Maybe I have to do this
from scratch, but I'd like to avoid that.

Any help on how this should be accomplished would be much appreciated.
Thanks!
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a


Are you talking about a parent - child list of data. The company being
the parent and the employee table being the child? I think you want to
use a datagrid to display the data. Do a search on Master-Detail
Datagrids

epigram wrote:
I'd like to know if there is a best approach, in terms of using the Data Web Controls (i.e. DataGrid, DataList & Repeater), for displaying data that is the result of a query that joins two tables that have a one-to-many
relationship. For instance if I perform a query on two such tables, I might expect that there would be data repeated on multiple rows from table on the one side of the relationship. What I want to do is display an HTML table row, or something similar, (using one of the Data Web Controls) on a web page for each "group". A group being the set of rows that has the same repeated data (dictated by the join).

For example, I might have a Company table and an Employee table. If I do a query joining these two (assuming some design decisions here), I'd have company data repeated in many rows for each employee that works for that company. I'd like to display the data in a row-based design on a web page that, for each display row, has the company data once and then the employee data for each employee that works for that company. So, the display would be (conceptually) something like this:

ACME Works Ltd. New York, NY

John Doe - hired: 7/8/1986
Jane Smith - hired: 9/1/2004
Bob Harris - hired: 3/5/2002

---------------------------------------------

ABC Company Inc. San Diego, CA

Bob Smith - hired: 3/7/1999
Judy Davis - hired: 3/9/2002
John Roberts - hired: 2/3/2004

---------------------------------------------

....

So, each "visual row" is really comprised of multiple records in the query's result set. This is where my confusion comes in. Most of the example I have seen with the Data Web Controls seem to have a one-to-one relationship between a record from a query and a "visual row". There may be some
treatment of the data (i.e. change the color, make it a link), but I haven't specifically seen an example of what I want to do. Maybe I have to do this from scratch, but I'd like to avoid that.

Any help on how this should be accomplished would be much appreciated. Thanks!


Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.