StrataFrame Forum

ComboBox with a "Not Selected" option

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

By Scott - 9/13/2006

How would you recommend implimenting such a combobox.  I am using the SF combobox and populating that combo with a business object.  I have tried adding a row to the business object (Not Selected) and not saving the data and that seems to work but I just can't find the right setting to get the form to NOT prompt to save if there is changes on the combobox's business object.  My form include settings are all set to DeterminedByBusinessObject and this business object is not directly on the form, it is in a custom user control that is being added to the form, no BOTranslation is being done for this BO. Its include settings are all set to false.  When I look at the forms businessobject coolection in the unsavedchagesexist event I notice that that bo is listed and isdirty is set to true.

Any suggestions?

By StrataFrame Team - 9/14/2006

I would recommend that rather than adding the extra record to the business object you should use the TopMostItem() option on the ComboBox itself... you can specify both value and a display value for the top most item in the list... generally "<Not Selected>" and 0, or something like that.

Also, if you ever add a record to a business object manually, and you don't want that record to make the business object dirty, then you can accept the changes on the row like this:

MyBO.CurrentRow.AcceptChanges(); //-- Make sure you're on the right row...

This way, you add new rows all day log without the business object thinking it's dirty.

By Scott - 9/14/2006

Thanks for the info.  I really gotta get my boss to send me to the next class.
By StrataFrame Team - 9/14/2006

Smile I know it helped several people.