StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      


123»»»

Accessing additional combobox columns...Expand / Collapse
Author
Message
Posted 05/09/2006 2:30:36 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame 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.
Post #1176
Posted 05/09/2006 3:51:20 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 10/21/2008 9:20:58 AM
Posts: 2,685, Visits: 1,887
No, the ComboBox is not sophisticated enough to store a tag like the ListView, so you can only store the information in either the display or the value column.  If necessary, you can call your stored procedure on a business object on the form (not the one dynamically created for the ComboBox) and use the CopyDataFrom method to copy data into the dynamicly created business object.  Then you would still have the business object on the form with all of the information necessary and you could Seek() to the record you need off the value in the ValueMember of the ComboBox.  Other than that, you would need some sort of complex drop down list with a custom control (like you would find in a 3rd party control suite).


www.bungie.net
Post #1178
Posted 05/10/2006 7:59:41 AM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 07/09/2008 2:20:16 PM
Posts: 436, Visits: 944
Ok. So now I'm going to use a DevExpress LookUpEdit. I'm assuming I can't do the piggyback thing with the lookupedit. Right? Is there another way or do I need to create a dataadapter and a dataset to fill the lookupedit?
Post #1181
Posted 05/10/2006 8:43:16 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 10/21/2008 9:20:58 AM
Posts: 2,685, Visits: 1,887
On a LookupEdit, you can set a business object as the DataSource.  Just remember to set the IsListSource property to True on the business object before you set it as the DataSource.  Then, yes, you will still be able to piggy back off of a business object.


www.bungie.net
Post #1184
Posted 05/10/2006 10:49:56 AM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 07/09/2008 2:20:16 PM
Posts: 436, Visits: 944
On the LookUpEdit I have set the datasource to the BO. I have set the DisplayMember and ValueMember to "hidden" fields (by hidden I mean columns from the Stored Procedure I'm going to use to fill the combobox). And I have the columns set the same.

I discovered that I have to call the method of the BO that executes the Stored Procedure before it will fill the LookUpEdit. When I do that, though, I havent filled the BO with its Primary data, so something funky happens to the grid I have bound to the BO. I see a number of blank rows that correlates to the number of items in the combobox I've filled using the piggyback method.

Of course once I fill the BO with its primary data the grid fixes itself and displays the BO data correctly. Just wondering if this is something you guys need to know about as far as a "bug".
Post #1185
Posted 05/10/2006 11:08:02 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 10/21/2008 9:20:58 AM
Posts: 2,685, Visits: 1,887
It's not really a bug... the DevExpress control is building its column list at design-time, and the columns on the business object change at runtime, so you just need to call Me.LookUpEdit1.Properties.PopulateColumns() to rebuild the column list off the data that's actually in the business object (where "LookUpEdit1" is the name of your LookUpEdit control).  Then you should be good to go.


www.bungie.net
Post #1187
Posted 05/10/2006 11:14:44 AM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 07/09/2008 2:20:16 PM
Posts: 436, Visits: 944
After I said all that I ran into a problem.

When i filled the BO with its primary data it erased the data in my combobox.
Post #1189
Posted 05/10/2006 11:17:26 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: 10/21/2008 9:20:58 AM
Posts: 2,685, Visits: 1,887
Yes, since the LookUpEdit is not one of our controls, it's not dynamically creating an instance of the business object on the back end, but actually using the business object that you're setting as the data source.  You'll need two different business objects on the form; one to be the source of the LookUpEdit, and one to be the primary business object you're working with.


www.bungie.net
Post #1190
Posted 05/11/2006 2:51:50 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: 07/09/2008 2:20:16 PM
Posts: 436, Visits: 944
combobox.SelectedText isnt returning the value shown in the combo box after the selection. SelectedValue works ok though. Am I doing something wrong? I'm using the SF combobox which I assume inherits the windows one.
Post #1211