2
votes

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

1
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
My ObjectDataSource is bind to Carrinho and the SELECT method is SelectAll() wich returns the list of Arranjo. - Joao Heleno

1 Answers

3
votes

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