This is a migrated thread and some comments may be shown as answers.

Bind Multiple DropDowLists to Same DataSource

1 Answer 200 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 28 Jun 2012, 10:50 PM
I have a situation where I have a list of topics (stored in a datatable) that I would like to tie to multiple dropdownlists on separate tabs of my form.  In doing so, it appears that when I change the value of one, it changes the value of the other, triggering all of the index_changed events and every other repercussion that goes along with that (default values, etc.).  

Is there a way to tie this same datatable to multiple dropdownlists without having the selections mirror one another? I realize that I could loop over the table and add items but I would rather not go down that road.  The code that I am using to bind is below.  Any help would be appreciated.

With ddSMTaskType
                .BeginUpdate()
                .ValueMember = dtTaskType.Columns(0).ColumnName
                .DisplayMember = .ValueMember
.DataSource = dtTaskType 
                .SelectedValue = "Meeting"
                .EndUpdate()
End With

With ddSTTaskType
            .BeginUpdate()
            .ValueMember = dtTaskType.Columns(0).ColumnName
            .DisplayMember = .ValueMember
            .DataSource = dtTaskType
            .SelectedIndex = 0
            .EndUpdate()
End With

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 03 Jul 2012, 10:47 AM
Hello Stephen,

Thank you for this question.

The experienced behavior is the desired one. When different controls share the same data source (datatable), their current position is synchronized by the currency manager. This is possible because RadDropDownList handles the CurrentChanged event of the currency manager. This synchronization cannot be avoided.

Should you have further questions, we will be glad to help.

Kind regards,
Peter
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Tags
DropDownList
Asked by
Stephen
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or