pedsys
asked on
How to get databound comboboxes to work correctly on windows forms DataRepeater control
Hi
I have a windows form with DataRepeater control on it. (I got this from Powerpack version 3)
I can drag fields from my datasource onto the repeater
I can set the default control type for fields to be Combobox and can drag them on and set their databindings.
All controls display correct information except the Combobox controls. These do have the correct list of items, but all seem to disply the value of the current record, not their own databound value.
I've seen mention of others with a similar issue, but not found an anwser yet.
Any ideas?
Thanks, Mike
I have a windows form with DataRepeater control on it. (I got this from Powerpack version 3)
I can drag fields from my datasource onto the repeater
I can set the default control type for fields to be Combobox and can drag them on and set their databindings.
All controls display correct information except the Combobox controls. These do have the correct list of items, but all seem to disply the value of the current record, not their own databound value.
I've seen mention of others with a similar issue, but not found an anwser yet.
Any ideas?
Thanks, Mike
Its probably because you are setting the databindings only. When you set the databindings, all controls display data related to the current row. You need to set the DataSource, DataMember, DisplayMember, and ValueMember properties of the comboboxes.
ASKER
I've checked DataSource, ValueMember, DisplayMember and that SelectedValue are set correctly
Can't find DisplayMember property
Thanks for trying anyway.
Can't find DisplayMember property
Thanks for trying anyway.
ASKER
..sorry, misprint in last comment. It's the DataMember property I cant find..
If you have correctly configured the DataSource, DisplayMember, and ValueMember properties then it should produce the desired result. What is the datasource you are using for the combobox?
ASKER
For the combobox showing a list of Operators (people taking calls)
DataSource = OperatorsBindingSource
DisplayMember = Operator
ValueMember = OperatorID
SelectedValue = NotesBindingSource - OperatorID
..where NotesBindingSource is the main table.
It seems to happen when the a new record is scrolled into view that has a diifferent Operator to the previous record. At that point all combobox values in view are set to the same value which is the value of the new record.
I've even tried resetting this in DrawItem event but to no avail...
Is there any relationship setup between OperatorsBindingSource and NotesBindingSource?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.