| | | 
StrataFrame User
       
Group: StrataFrame Users Last Login: 07/09/2008 2:20:16 PM Posts: 436, Visits: 944 |
| I've noticed that when I'm setting up a combobox to be filled using a BO that I only have two columns to work with. The value column and the display column. Obviously the value column contains the ID and the display column can be a single field or a combination field. IE {1} or {1}{2}. I'm assuming I cant add any more columns to the combo box to hold related information about the items in the combo box.
If I am able to add more columns could you please instruct how to do so and then tell me how to access the information in these extra columns.
OR How would I query the datatable in the BO that contains the extra data. Keep in mind I'm piggybacking on a BO. Which is to say I'm executing Stored procedures to return records to fill combo boxes with.
This is an old post from May... I just wanted to see if this functionality has been added yet.
Thanks |
| | | | 
StrataFrame User
       
Group: StrataFrame Users Last Login: 07/09/2008 2:20:16 PM Posts: 436, Visits: 944 |
| | OR if I know how to do this with a DevExpress control that will still work on the inherited controls, right? |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: 10/21/2008 9:20:58 AM Posts: 2,685, Visits: 1,887 |
| You cannot get more information from a combo box because the DataTable that is created for the combo box only contains the two columns that are the display member and the value member... 
www.bungie.net |
| | | | 
StrataFrame User
       
Group: StrataFrame Users Last Login: 07/09/2008 2:20:16 PM Posts: 436, Visits: 944 |
| Ok. Thanks. I won't ask again. |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: 10/21/2008 9:20:58 AM Posts: 2,685, Visits: 1,887 |
| You can, however, use a BusinessBindingSource wrapped around the business object and use it as your DataSource on the combo box (forgoing the PopulationDataSourceSettings) and only set the DisplayMember. Then, when you access the SelectedValue, it will return an instance of the business object you used to populate the list, and you will have access to all of your properties on the business object. The downside is that you can only select one field as the DisplayMember (you cannot concatenate more than one of them together), so you will have to concatenate the fields on SQL Server or somewhere else.
www.bungie.net |
| | | | 
StrataFrame User
       
Group: StrataFrame Users Last Login: 07/09/2008 2:20:16 PM Posts: 436, Visits: 944 |
| | Could you provide some code to get me started on that idea? |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Yesterday @ 3:20:54 PM Posts: 4,769, Visits: 4,731 |
| | This is actually done through the designer. Just drop a BindingBusinessSource control on the form, choose the business object to wrap on the BusinessBindingSource. Once this is done, go to your combo box and select the DataSource property and select the BusinessBindingSource. Then go to the DisplayMember property and ValueMember properties and select the appropriate fields. |
| | | | 
StrataFrame User
       
Group: StrataFrame Users Last Login: 07/09/2008 2:20:16 PM Posts: 436, Visits: 944 |
| Here is my scenario... I'm not going to use a DevExpress combobox (not an inherited one) and I'm going to bind it to a BBS which is bound to a BO. Now because the datatable in the BO has more columns than the combobox I need to be able to access those columns based on the value member i selected in the combobox. How can I do this?
I hope I have been clear... this binding source stuff has kind of thrown me and some of my code for a loop. |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: Yesterday @ 3:20:54 PM Posts: 4,769, Visits: 4,731 |
| | In my previous post, I mentioned the ValueMember property. Whatever field you associate with the property is what will be used to provide the value when referencing the SelectedValue property. Does this make sense? |
| | | |
|