By LeRoy Jackson, Jr. - 11/28/2006
Hello Everyone! I am very new to this so this is probably a very simple question.I have droped my primary BO (Library1) on my my form. On the text boxes, everything is bound correctly, however on my combobox doesn't show anything. I created a second BO (Authors) so that the combobox's values would be populated from that. I created a method called FillAll that belongs to the Authors' BO. This is what I have set on the combobox's property: combo.PopulationType = Busniess object, combo.PopulationDataSourceSettings = Authors.FillAll(), combo.BusinessObject = Library1, combo.BindingField = AuthorName. If I remove the Businessobject and bindingField, The combo is populated but not Bound to the Record. When I put it back, It is not populated and the values are not loaded. What am I missing? Thanks In Advance. LJ
|
By StrataFrame Team - 11/28/2006
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.
|
By LeRoy Jackson, Jr. - 11/28/2006
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
|
By StrataFrame Team - 11/28/2006
Yep, I'd say you're doing pretty well
|
By multiSingularity - 7/20/2008
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.
|
By Trent L. Taylor - 7/21/2008
It is more than likely going to be one of two things, or both.- 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).
- 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.
|
By multiSingularity - 7/21/2008
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.
|
By multiSingularity - 7/21/2008
Oh yes, and the PopulationDataSourceSettings Value member is set to the ID as required.
|
By Lesscher - 7/21/2008
Hi all, I have the same issue here and I would like to see a small sample to, if that's possible.
|
By Edhy Rijo - 7/22/2008
Hi guys,Please download a combobox sample posted by Trent on the forums sometime ago. http://forum.strataframe.net/FindPost17985.aspx
|
By Trent L. Taylor - 7/22/2008
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.
|
|