Businessobjects - Databinding in ASP.net

Businessobjects - Databinding in ASP.net

Old forum URL: forums.lhotka.net/forums/t/1504.aspx


Undying posted on Monday, October 16, 2006

Hello!

My question is doesn't directly target CSLA.net. Hope i'm not wrong here with my question ;-).

A Businessobject have some ChildObjectLists. (Collections of other Businessobjects). This Childobjects are accessable via a Readonly Property in the "main" object. (Examle: A Voucher with a List of Positions)

I thinks this is the way it should be done. Now i have troubles with databinding in ASP.net. I could use a objectdatasource to bind my businessobject to a Formview. This works like a charme and i could Edit/Update and so on. Everything is fine.

I could also bind the "ChildCollection" to a Gridview in my Formview. But i have NO glue how to update this "clientcollection.
Any idea to solve such requirments?

Best regards

pfeds replied on Wednesday, May 14, 2008

I know this is a fairly old post that hasn't been replied to, but I'm having similar difficulties at the moment with databinding the child collection to a GridView within a FormView.

I have a Product object with a child collection of ProductVariants (i.e. a product could be a table, and a variant could be a certain size of that table).

I'm creating a ProductEdit aspx page that will handle both inserting a Product or updating an existing one.

So... I have a FormView bound to a ProductDataSource.  I want the product information at the top of the page, then a GridView which will allow adding/deleting product variants, and then finally a Save/Update button at bottom.

At present I can add items to the child gridview, but this means when I rebind the data then any properties I have set for the Product disappear (due to them not being saved to the object before the page refresh).  That is unless I write code to get each TextBox from the FormView and update the properties one by one, which I would rather not do.

From looking at ProjectTracker I wondered if it would be a better option to have one datasource for the product and another datasource for the child objects in the GridView...?  I can't see that resolving the issue or maybe I haven't considered something.

Copyright (c) Marimer LLC