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

multiple tables in 1 web DataGrid

P: n/a
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","descri ptors")
myDatagrid1.DataBind()

but this is not correct syntax

any help on this appreciated.
Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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...

"Maverick" <Ma******@discussions.microsoft.com> wrote in message
news:A0**********************************@microsof t.com...
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","descri ptors")
myDatagrid1.DataBind()

but this is not correct syntax

any help on this appreciated.

Nov 19 '05 #2

P: n/a
Datagrid can bind to one table only.

Eliyahu

"Maverick" <Ma******@discussions.microsoft.com> wrote in message
news:A0**********************************@microsof t.com...
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","descri ptors")
myDatagrid1.DataBind()

but this is not correct syntax

any help on this appreciated.

Nov 19 '05 #3

P: n/a
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.
--
Joe Fallon


"Maverick" <Ma******@discussions.microsoft.com> wrote in message
news:A0**********************************@microsof t.com...
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","descri ptors")
myDatagrid1.DataBind()

but this is not correct syntax

any help on this appreciated.

Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.