Databinding question

Databinding question

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


k2so posted on Friday, June 06, 2008

I have a enum list object that contains a list of "document types" , for example:

id        name
========
1        word
2        excel
3        image
4        sound
...

Then, there's a BO, "document" with the read/writeable  property, int doc_type -> which is supposed to reference the enum list above.

The question is: In the Gui for specifying the document properties (all others are textbox, binded to the corresponding property directly), I am having a combobox binded to the enum list object.

How may I implement an update to the document object on a selected_index change event?

Since there's no binding to the document object, does that mean I have to update the property manually in the event handler?

What if, I have a collection of documents, how may I access each of the document's doc_type property?





SomeGuy replied on Friday, June 06, 2008

Check out: http://forums.lhotka.net/forums/thread/23210.aspx for info on creating Name/Value lists based on enums.

 

k2so replied on Friday, June 06, 2008

maybe i should clarify a little. the enum list is indeed a nvlist class, not an enum.

RockfordLhotka replied on Monday, June 09, 2008

Usually you would be using a combobox control (or something similar) when doing a binding like this. The combobox control binds to two objects: the object populating the list, and the actual business object with the property to set.

If you are only binding to populate the list, and not binding to the actual business object's property, then yes, you will need to write code to handle the index changed event and manually set the object's property.

Copyright (c) Marimer LLC