StrataFrame Forum

Binding a control to a Business object NOT on the form

http://forum.strataframe.net/Topic2133.aspx

By Scott - 8/8/2006

Is there a way to get winforms controls to bind to a business object that is NOT on the form?

I have a class that has several BO's as properties and the class manages loading the BO's with the requested data and provides functionality to maintain the required table relations.  Is there a better way of doing this?  Maybe a view based on the underlying tables?  If this is the best option, would we need to used the DDT to set a primary key field so that the business object can update the view?

Thanks for any input.

By StrataFrame Team - 8/9/2006

You can programmatically set the business object that is bound to a control at runtime.  So, if you expose the business object as a public property on your class, you will be able to bind to it at runtime by setting the BusinessObject property on the control to the property returned by your class.  The only difference between binding at runtime and binding at design-time is that you will need to manually call Refresh() on the business object after you setup the binding so that the value is pushed out the first time.

I think the way you have it configured is probably your best bet.

By Scott - 8/9/2006

Thanks Ben,  works great.
By StrataFrame Team - 8/9/2006

No problem Smile