Standard way of doing ...

L

Lerp

Hi all,

I am building an app that has a lot of one to many relationships and was
curious as to the best method in displaying rows of data from both tables on
the same line.

ie:


row1 of 100 for example in my datagrid:

customerid(1st table), firstname(1st table), lastname(1st table),
orderid(2nd table), ordertitle(2nd table), orderdate(2nd table) etc....



Currently I am using join queries with column aliases and binding this to my
datagrid and using these to display the data from both tables in the same
row iteration of my datagrid. Is this pretty much the standard method of
performing this type of task?

Also, I am assuming that I set the Parent table when I use the fill method
on my adapter? (CUSTOMER Table being the parent between customer and
orders)

ie:
.......
Dim myCmdb as New SqlDataAdapter(strSQLb, MyConn)
myCmdb.fill(ds, "CUSTOMER")
.......



Any insight would greatly be appreciated as I have built this same page
several different ways and would like to know what other people think,
thanks

P.S excuse my newbness to .NET, I'm converting..lol :)

Cheers, Lerp
 
D

DalePres

You can display the childrows in a dropdown list or listbox nested within
the line of your datagrid, datalist, or repeater control that you use for
displaying the parent table. Search for the words: nested dropdownlist
datalist. You'll find dozens of articles in google, or MSDN.

Dale
 
L

Lerp

Thank you Dale, I will look into that to se if it what I need. I could
apply the same method but with dropdown boxes correct, or do I have to use
list controls?

Cheers, Lerp
 
D

DalePres

I have done it by starting with a list control and then displaying the child
rows in a list control or a drop down.

I'm not clear if you're asking about doing two dropdownlists, or about a
list control with the child table in dropdown list. I haven't done related
dropdowns in ASP.Net but that's a relatively common thing in client side
scripting using JavaScript. For ASP.Net, I'd do related listboxes by
setting AutoPostBack on for the parent dropdownlist. Cache the tables that
will be used to populate the child dropdown list and just change the
datasource/datamember for the child dropdownlist and call DataBind() on the
child, in yourSelectedIndexChanged event handler.

Dale
 

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,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top