2

Here's the problem I'm having in my asp project.

My shopping cart consists of 3 classes like the picture below.

The class Carrinho has a List of Arranjo wich by itself has a List of Product.

Now I want to display the Carrinho's list and I have a GridView whose data source is an ObjectDataSource that's associated to the Carrinho object. It should display, for now, just the Total property from Arranjo but I keep getting an empty page always. I have debugged the project and the list is definitely not empty.

What am I doing wrong?

classes picture

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Joao Heleno
  • 370
  • 3
  • 20
  • Your GridView is bind to a Carrinho Object or a list of Carrinho ? because you have not a method that return a Carrinho Object – Mostafa Jan 01 '10 at 20:01
  • My ObjectDataSource is bind to Carrinho and the SELECT method is SelectAll() wich returns the list of Arranjo. – Joao Heleno Jan 01 '10 at 20:09

1 Answers1

3

It's not regular to do that (biding a list of list<object> ) . Any way if you insist to do that you should know you need to bind a list of object to each item in GridView Row , So that item should be like List controls . otherwise you should convert your field to "ItemTemplate" and you bind by your own . Here is a good example


Hope that helps

Community
  • 1
  • 1
Mostafa
  • 3,002
  • 10
  • 52
  • 79
  • Just to clarify a little bit more...it's a web Flower Shop. A client can choose various bouquets and each bouquet has many flowers. That's why I have a list of list. Each cart has X bouquets with Y flowers. – Joao Heleno Jan 01 '10 at 20:44
  • You can Convert you column in GridView into ItemTemplate and put some ListControls like BulletList then you should bind them by you own – Mostafa Jan 01 '10 at 20:50