Hi all, I started off with CSLA a couple months ago and I must say, it's awesome. It thought me a lot and still does, so here's a small question.
I have a class 'SalesManList' which inherits from NameValueListBase and contains a static list of Ids and names of salesmen. It's based on the class 'RoleList' from the ProjectTracker example.
In a windows form, I have 2 comboboxes which are bound to this static list.
cmbPartsResponsible.DataSource = SalesManList.GetList();
cmbWorkShopResponsible.DataSource = SalesManList.GetList();
(ValueMember = "Key", DisplayMember = "Value")
My problem is, that when I change the value of one combobox, the other also gets the same value.
E.g. I set combobox cmbPartsResponsible to "John Smith", then the value of cmbWorkShopResponsible also changes "John Smith". This is probably due to the static list in the class 'SalesManList'.
Could anyone tell me what I'm doing wrong here or how I could resolve this issue?
Many thanks, J.
Indeed Brian, I had to set up two separate BindingSource objects. Thx a lot.
Thanx for the response.
The SalesManList does not keep track of the SelectedValues. There's a root BO 'Client' which contains the properties PartsResponsibleId and WorkshopResponsibleId, so they keep track of the selectedValue.
In design view I bind clientBindingSource.PartsResponibleId to the SelectedValue of cmbPartsResponsibleId and clientBindingSource.WorkshopResponsibleId to the SelectedValue of cmbWorkshopResponsibleId. In the OnLoad method of the windows form, I populate the comboboxes as following:
cmbPartsResponsibleId.DataSource = SalesManList.GetList();
cmbWorkshopResponsibleId.DataSource = SalesManList.GetList();
J.
Copyright (c) Marimer LLC