multiple tables in 1 web DataGrid

G

Guest

Assume i have 2 tables stored in a single dataSet (ds) and the relationship
is well added
ds.Tables("product")
ds.Tables("descriptors")

what I want to do is show the data from 2 of the tables, linked by the
relationship, on the SAME DataGrid juz like the data is select by "Join" but
i cannot find the correct code to do this.

I am looking for something like:

myDatagrid1.DataSource=ds.Tables("product","descriptors")
myDatagrid1.DataBind()

but this is not correct syntax

any help on this appreciated.
 
J

Jason

I have never tried this with the standard .NET DataGrid.
I have not tried this, but what about just

myDatagrid1.DataSource=ds; //maybe .NET's DataGrid can recognise these
relationships and display accordingly?
myDatagrid1.DataBind();

?
Infragistics UltraGridControl (3rd party datagrid) recognises the
relationships in datasets and displays them quite nicely. expandable,
collapsable, etc.
maybe have a look at using their grid? I am talking from a winform
experience, not sure if their ultragrid for web would be the same...
 
J

Joe Fallon

I have successfully done something like this using 2 repeaters.
The first repeater drives the "product" table and then *nested* inside the
first repeater is a 2nd repeater which drives the "descriptors".

This way, each "product" can have multiple associated "descriptor" records.
The inner repeater is fired once for each row of the outer repeater.

There is some sample code on te web showing how to do tihs with datatables.
I had to modify the code to work with collections of Business Objects but
the idea is the same.
 

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,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top