StrataFrame Forum

Pulling additional data from the BO used as datasource for Combobox

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

By Charles R Hankey - 9/29/2009

As I understand it once a cbo is populated from a BO there is no longer any connection - i.e. there is no record pointer moving in the BO in conjunction with the SelectedValueChanged on the CBO.



The "data" in the cbo itself consists only of the Value and the Display.



So, in the selectedvaluechanged I want to sync the BO so that I can refer to it in code after a cbo selection and get other values in that row in the lookup table.



I can think of lots of ways to do it - seekbyprimarykey(me.cbo.selectedvalue) would get me to the right row. At that point I suppose I could copy the row data to a property defined as a datarow.



But ideally, I'd like to have a property with strongly typed properties ( i.e. a one record BO ) that I could refer to as lookup.field5 for a value that corresponds to another column in the BO.



I'd probably do that with LINQ



But I'd like to make sure I'm not just going brain dead on something already wired into the framework for this fairly common task ???



Suggestions ?
By Edhy Rijo - 9/29/2009

Hi Charles,



Whenever I need to use or make reference to a lookup field other than selected value from combobox or listview, I use the following configuration for the combobox and the listview:



1- Add an instance of the lookup data BO in the form.

2- Configure the combobox or the listview to use the CopyDataFrom.... population so the lookup data will always be available to be used.

3- In the case of the listview there is a property to keep it in sync with the assigned BO and for the combobox you can use the BO.SeekToPrimaryKey(combobox.SelectedValue), of course check that the combobox.SelectedValue is not Nothing.
By Charles R Hankey - 9/30/2009

Thanks, Edhy. Yes, that does seem to be the most straightforward way to handle it and it is the approach I've been taking so far. I was just wondering if there was something I was missing for keeping them in sync. Somehow last night it all seemed more complicated than it does this morning Smile I have to start knocking off from work after dinner ...
By Edhy Rijo - 9/30/2009

Charles R Hankey (09/30/2009)
Somehow last night it all seemed more complicated than it does this morning Smile I have to start knocking off from work after dinner ...




You are welcome Charles. I have had the same feeling many times (just read some of my post BigGrin). I also need some time off, but one of my project is currently under heavy beta testing, plus incorporating AppLife Update, Licensing Manager and Obfuscator add a bit of happiness to the mix Hehe