Hi!
I have a similar situation and am not sure what to do.
Have a WinForm with a DataGridView with 20+ columns out of which 3 columns in the grid are Combobox's.
How many and what type BO's do I need. Here is what I think I should do:
For the MainTable: (Project)
1 BO of type EditableRootList (collection) - ProjectList
1 BO of type EditableChild - ProjectItem
For LookupTableA (Client)
1 BO's of type NameValueList (to be used in the comboboxcolumn in the grid) - ClientNVL
For LookupTableB (Plant)
1 BO's of type NameValueList (to be used in the comboboxcolumn in the grid) - PlantNVL
For LookupTableC (Area)
1 BO's of type NameValueList (to be used in the comboboxcolumn in the grid) - AreaNVL
Does the above make sense?
I use CodeSmith 2.6 and the CSLA20 templates to generate my BO's but I am using CSLA 2.1 beta. Will this cause other issues?
Thanks
Sarosh
In CSLA 1.x there was no BindableList property for the NVL.
This flaw was discovered early in the release and was overcome by a user who posted the code you need to add to the NVL class in CSLA 1.x in order to make it bindable.
My copy is all hacked up so I won't post it but here are the comments:
#Region " Binding "
'added by JF on 11/14/2003 for databinding a cbo with a hidden ID and displayed Value.
'posted by Matt Tag in CSLA forum 11/12/2003
'Thread = Populating a combo box from CSLA...
' Now, from inside your project, you can do this:
'With cbo
' .DataSource = MyCompany.BO.xxxNVL.BindableList
' .DisplayMember = "Key"
' .ValueMember = "Value"
'End With
'In DataBind code add:
'BindField(cbo, "SelectedValue", mBO, "BO Property")
'Also - handle the SelectedValueChanged event of the cbo.
'Forces Databinding to work when cbo is changed and NOT tabbed off of.
'mBO.Property = cbo.SelectedValue
Private mBindableList As ArrayList
ReadOnly Property BindableList....
Do a Search to get the original code.
Joe
Joe, thanks for pointing this out. You saved me a lot of time.
For everyone's reference, here's a link to the code (C# & VB)
-Jay
Copyright (c) Marimer LLC