By lastcanary - 9/28/2010
Hi,
We are working with combobox control and trying to use it in our application. We found that if a field is a required field and it is connected to a Business Object through a combobox control even if the combobox is filled with a value it is giving a broken rule error while saving.
I am sending you an example in the Strataflix application. If you check the movie maintenance form (MovieMaintenance.cs) I substitiued the Movie field from a textbox to a combobox. I populated the combobox from PeopleBO by adding FillTop100 Method to this BO. When you select something for the comboboxbox and fill the rest and click the save button it gives a broken rule error.
Could you please help us to fix this error?
Best Regards
|
By Edhy Rijo - 9/28/2010
Hi,
Well, you are getting the broken rule error because the rule of not having the mv_Title is really broken .
In your new combobox the BindingField mv_Title is not being filled by the combobox population method, if you double check it, the Value Member being used is pl_pk from the PeopleBO and that is the value used to fill the BindingField mv_Title which are different.
Can you please explain, what is it that you want to accomplish?
|
By lastcanary - 9/28/2010
We were just trying to use combobox for our form. We are simply tring to get a string in the combobox. We changed the pl_pk to pl_FullName since it is a string field, but the broken rule still exists.
Could you please fix the code and send us the corrected source code?
Thanks
|
By Edhy Rijo - 9/28/2010
Instead of fixing it, I rather you learn from it.
In this particular case, the business object MoviesBO.cs has the mv_Title as part of its Required Fields collection. If that is not what you want, simply open the BO and uncheck the mv_Tile from the Required Fields Editor and then the form will save without a broken rule.
Take a look in the help file at the Required Fields and they can be useful for your own logic.
|
By lastcanary - 9/28/2010
We already know that mv_Title is set as a required field. We are selecting a string for the combobox so mv_Title is not empty, why are we getting the broken rule then?
We want to have a field that is a required field but can also be set from a combobox, is this not possible?
|
By Edhy Rijo - 9/28/2010
Ok, if that is the case, then change the BindingProperty of the combobox to SelectedValue. That should do the trick since comboboxes use the SelectedValue for binding.
By the way, what is your name?
|