Monday, August 16, 2010

Gridview - Bind Object Array. .NET 2.0?

I'm going to make this as least confusing as possible..it's kind of hard to explain though.





I have a shopping cart that's stored into session. I have a gridview on an aspx page that i want to bind this full shopping cart to.





The shopping cart is an object of a class cart.cs. This class basically contains an arraylist of other objects (items.cs).





items.cs refers to each individual product added to the cart. it has 2 fields: a products object (that contains all relevant information to that product in it's properties) and an integer quantity value.





So, the hierarchy is something like this:





Session[';Cart';] --%26gt; Cart (arraylist of items) --%26gt; items (includes product object and quantity value) --%26gt; product object (contains all relevant information to that product.





How can I get this into a gridview on binding from the backend?





Any help is appreciated greatly.Gridview - Bind Object Array. .NET 2.0?
The object that you are binding must implement the IListSource interface.

No comments:

Post a Comment