CheckedDropDownList with Databound list with default checked items issue

3 posts, 0 answers
  1. Mark
    Mark avatar
    75 posts
    Member since:
    Oct 2014

    Posted 25 Oct Link to this post

    I have a RadCheckedDropDownList that I am binding a BindingList to it. Some of the items in the list will have the CheckedMember property filled in. However, after the control loads, the items that are checked do not show up in TEXT area of the control. However, if you open the dropdown, you can see items checked.  As soon as you uncheck or check an item, all the checked items do show up.  This is a problem, I need the items that are checked by default to show up in the TEXT area.  Below is my code that I use to bind my list to the control.  Am I missing something?


    private static void BindList (this RadCheckedDropDownList radDropDownList, BindingList<CheckedListItem> dropDownList, string valueMember = "Key", string displayMember = "Value", string checkedMember = "Checked")  
    {
    radDropDownList.BeginUpdate();
    radDropDownList.ValueMember = valueMember;
    radDropDownList.DisplayMember = displayMember;
    radDropDownList.CheckedMember = checkedMember;
    radDropDownList.DataSource = dropDownList;
    radDropDownList.EndUpdate();
    radDropDownList.SelectedIndex = -1;
    }

  2. Mark
    Mark avatar
    75 posts
    Member since:
    Oct 2014

    Posted 25 Oct Link to this post

    Ok, the solution was to remove the "BeginUpdate()" and "EndUpdate()" from my code.  
  3. Dess
    Admin
    Dess avatar
    2196 posts

    Posted 26 Oct Link to this post

    Hello, Mark,

    Thank you for writing.  

    I am glad that the problem you were facing is now resolved. Indeed, it is necessary to remove the Begin/EndUpdate methods. Usually, they can be used in situations when you add or modify a lot of items. Thus, the UI will be refreshed only once when calling the EndUpdate method, not with each add/edit operation.

    I hope this information helps. Should you have further questions I would be glad to help.

    Regards,
    Dess
    Progress Telerik
    Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top