Trouble binding and displaying two tables of related data

cjmarks

New member
Joined
Mar 5, 2009
Messages
2
Programming Experience
5-10
I am new to using VB and .NET together so please let me know if there is a better way to do this.

Currently in my database I have a table of Categories. I also have a table of Products. Each product in the Products table belongs to a category in the table Categories.

Right now I am displaying all my Categories using an asp: DataList object. What I need to do next is for each of those categories displayed, I want to display all the products in that category, probably in an asp:Listbox.

The problem I am having is I am unsure how to display another query inside the DataList based on the current category that it is being displayed. This way I can display all the products associated with each category that the DataList goes through. Can I put some other interface inside the DataList and ItemTemplate that will help me with this?

I know if I do an Eval("<column_name>") I can get the current category that is being displayed but I am not sure how I can put this into another SQL query and bind it to a list box inside that DataList.

What would be the best interface to use or maybe someone even could point me towards a tutorial that can help me with this problem?
 
Thank you for the tutorials. I am having a bit of trouble reading them. Maybe because they extend over multiple pages. For example, these lines of code.

Dim productAPI As ProductsBLL = New ProductsBLL()
allProducts = productAPI.GetProducts()

This part of the code is for returning all their products as a table but I'm not sure how to do that because I don't see anywhere on that page where the class ProductsBLL is defined.
 
Last edited:
that because I don't see anywhere on that page where the class ProductsBLL is defined.
Most likely from the "Creating a Business Logic Layer" (BLL) article. Also, don't you get it all from the "Download the code for this tutorial" link ?
 
JohnH is correct that the BLL is created in an earlier tutorial. I thought this may have been an issue so the second link I provided was to the entire series.

The BLL layer is going to be the middle man between the DAL and your UI layer so you'll want to check out #1 Creating a Data Access Layer before you read Creating a Business Logic Layer.

If I remember correctly the "Download the code for this tutorial" will give you all of the code through the tutorial that you're reading.
 
Back
Top