Binding Combobox Issue


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
There are a lot of samples that come with SF that show how to populate a combo including the sample that Edhy reposted.  please look at those as I am sure that through the examples you can compare and see what you are missing.  Thanks.
Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi guys,

Please download a combobox sample posted by Trent on the forums sometime ago.

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

Edhy Rijo

Lesscher
Lesscher
StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)
Group: StrataFrame Users
Posts: 9, Visits: 19
Hi all, I have the same issue here and I would like to see a small sample to, if that's possible.
multiSingularity
multiSingularity
StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)
Group: Forum Members
Posts: 9, Visits: 17
Oh yes, and the PopulationDataSourceSettings Value member is set to the ID as required.
multiSingularity
multiSingularity
StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)
Group: Forum Members
Posts: 9, Visits: 17
I am binding on SelectedValue, as it is the ID that I need to store, not the Description.



Do you have some sample code that illustrates binding a combo box to a BO, but populating it from a different BO? Or if not, even just binding to a BO? The only stuff I've seen populates from an enum, and I believe I have followed the instructions in the SF help, to no avail.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
It is more than likely going to be one of two things, or both.

  1. On the PopulationDataSource property (within the designer) ensure that the Value Member is set to the proper field (this is the vallue that will be stored exposed through the Selectedvalue property of the combo).
  2. If you are using the Selectedvalue property to which to bind (the default) the #1 is probably your issue.  Otherwise, you can change the BindingProperty to Text instead of Selectedvalue on the combo itself which will then use the Text property (which is probably already displaying correctly).

Either or both of these should get you going in the right direction.

multiSingularity
multiSingularity
StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)StrataFrame Beginner (9 reputation)
Group: Forum Members
Posts: 9, Visits: 17
I'm having pretty much the same problem, but I'm afraid I didn't really follow your answer. I've reviewed lots of forum posts (and even read the help - gasp!) on this issue but I cannot find my problem.



I am working up a basic Customer maintenance form with customer details and address. These come from the Customer_Master and Customer_Address tables. These tables also contain foreign keys to rows in a lookup table called Std_Codes, for information like title (Mr, Mrs etc) and street type (St, Rd, Ave, etc). The different standard codes are grouped together by a standard code type ID, which we can use to retrieve all titles or all street types etc.



I have a Customer BO, which has a "TitleCode" property, and a CustomerAddress BO with a "StreetType" property. As discussed above the title literal is not stored directly in the customer table but comes from a list of title codes stored in the Std_Codes table - hence I also have a StandardCodes BO, which has a method to populate by the standard code type (Title Type, Street Type, etc). The StandardCodes BO has "StdCodesID" and "Description" properties - the StdCodesID is the value stored in the customer record for title code.



On the form I have Title and Street Type combo boxes. The combos need to populate themselves from the StandardCodes BO (two instances of which exist on the form and are called titleTypes1 and streetTypes1) but the selected value needs to set its ID back into the TitleCode property of the customer and the StreetType property of the address respectively.



So far so good... so I have bound the Title combo to the Customer BO, and the StreetType combo to the CustomerAddress BO, since that is where the selected values are read from and written to, and they are populated at form load from their respective StandardCodes instances. As far as I can tell I have followed the directions in the help, but the combo boxes are disabled at run-time. Following the property settings for the Title combo we have:



BindingField: TitleCode

BusinessObject: customer1

DisplayMember: Description

PopulateOnFormLoad: FormLoad

PopulationDataSourceSettings: StandardCode.FillByCodeType(string)

PopulationType: BusinessObject



List Population settings:

Business Object Type: StandardCode

Method to execute: FillByCodeType(string)

Display member: Description

Value member: StdCodesID



In the form code I have the following event handler:



private void cboTitle_ListPopulating(ListPopulatingEventArgs e)

{

e.Parameters[0].Value = "TITTY";

}



where the parameter value identifies the standard code type (apologies for the unfortunate abbreviation of Title Type!).



I hope this makes some kind of sense. I'm guessing the problem is going to relate to the fact that I am populating the combo from a different BO than the one it is bound to... but I can't figure out the solution. Selecting foreign keys from lookup tables, to be stored in the main table, is after all a very common sort of operation so I figure you have to support it.



To try to diagnose my problem I added another combo box to the form, and just bound it to the titleTypes1 BO (with the other settings the same) but this gave me a combo that was not disabled, but which appeared to have lots of blank entries in it that were not selectable.



It shouldn't be this hard... I'm obviously missing something crucial.



Perplexed,

Andrew.







StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Yep, I'd say you're doing pretty well Smile
LeRoy Jackson, Jr.
LeRoy Jackson, Jr.
StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)StrataFrame Beginner (14 reputation)
Group: Forum Members
Posts: 14, Visits: 55
That was it.  In my Value It was to the wrong field.  Well, That wasn't too bad considering I have only been using Strataframe for less than 24 hours Wink
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
On the PopulationDataSource settings of the combobox, did you add the display fields and set the display format?  It also could be that when you bind the business object to a control, the business object will disable the control unless the business object is in an editing state (and it's idle by default), so it could be that the combo is populated, but it's disabled, so you can't drop it down and see the data.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search