Completed
Last Updated: 27 Sep 2018 07:54 by Dimitar
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 12 Sep 2018 06:35
Category:
Type: Bug Report
0
FIX. RadCheckedDropDownList - NullReferenceException when refilling items while the autocomplete popup is opened
To reproduce: please run the attached sample project and follow the steps illustrated in the gif file.

Workaround: use customRadCheckedListDataItems and disabled the autocomplete functionality while refilling the items

        private void button1_Click(object sender, EventArgs e)
        { 
            radCheckedDropDownList1.Items.Clear(); 

            radCheckedDropDownList1.AutoCompleteMode = AutoCompleteMode.None;
            foreach (string item in list)
            {
                radCheckedDropDownList1.Items.Add(new CustomRadCheckedListDataItem(item, false));
            }
            radCheckedDropDownList1.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
        }

        public class CustomRadCheckedListDataItem : RadCheckedListDataItem
        { 
            public CustomRadCheckedListDataItem(string item, bool isCheched) : base(item,isCheched)
            {
            }
            
            public override bool Checked
            {
                get
                {
                    if (this.ownerElement == null)
                    {
                        return false;
                    }
                    return base.Checked;
                }
                set
                {
                    base.Checked = value;
                }
            }
        }
0 comments