Bind Multiple DropDowLists to Same DataSource

2 posts, 0 answers
  1. Stephen
    Stephen avatar
    5 posts
    Member since:
    Sep 2011

    Posted 28 Jun 2012 Link to this post

    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
                    .ValueMember = dtTaskType.Columns(0).ColumnName
                    .DisplayMember = .ValueMember
    .DataSource = dtTaskType 
                    .SelectedValue = "Meeting"
    End With

    With ddSTTaskType
                .ValueMember = dtTaskType.Columns(0).ColumnName
                .DisplayMember = .ValueMember
                .DataSource = dtTaskType
                .SelectedIndex = 0
    End With
  2. Peter
    Peter avatar
    1160 posts

    Posted 03 Jul 2012 Link to this post

    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,
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
Back to Top