473,385 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

multiple tables in 1 web DataGrid

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
3 2971
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Brian | last post by:
I have a dataset containing 2 tables. I need to fill a datagrid using data from both of these. If I could create a SQL Statement to fill the datagrid, it would look like this: SELECT...
1
by: Craig Banks | last post by:
If a row of data in a dataset has a lot of columns the row displaying the data in a datagrid will run way off the screen. What I'd like to do is display a row of data over several datagrid rows so...
8
by: Jason L James | last post by:
Hi all, does anyone know if I can create a dataview from multiple datatables. My dataset is constructed from four separate tables and then the relationships are added that link the tables...
4
by: Dave Edwards | last post by:
I understand that I can fill a datagrid with multiple queries, but I cannot figure out how to fill a dataset with the same query but run against multiple SQL servers, the query , table structure...
0
by: dbuchanan | last post by:
How do I make multiple DataGridTableStyles serve the same table? (I can get multiple styles for the same datagrid, but not multple styles for the same *table* on the same datagrid) I want to do...
1
by: Waran | last post by:
How to bind Multiple results into a datagrid. For example Assume the values for dsCustCode.Tables(0).Rows.Count = 4,and the values are "'Val1','val2','val3','val4'" in the below loop In the...
7
by: samoore33 | last post by:
I want to list all of the items in a dataset in a textbox. The dataset has multiple tables. When I try to use the code below, even though I dim myState as the DataTable("state"). It still looks for...
1
by: Wan | last post by:
Hi, I have a test project consists of two forms. The main form contains a datagrid and a button. On click of button I populate the datagrid with a ds.table(0) so far so good and on grid's...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.