Search code examples
c#winformstelerik

RadCheckedDropDownList prevent typing


Is there any way i can prevent any inputs in the field in RadCheckedDropDownList object? I want to let the user check the items he wants but he must not have any acces to write in the field.

OR

Is there a way to check if what he types in the field exists in the Items and if do, select the first item he finds when control lose focus or delete if no item is found?


Solution

  • I used the explanation from this and it fixed my problem: https://www.telerik.com/forums/radcheckeddropdownlist-textbox-content

    private void radCheckedDropDownList1_LostFocus(object sender, EventArgs e)
    {
         string delimiter = this.radCheckedDropDownList1.CheckedDropDownListElement.AutoCompleteEditableAreaElement.AutoCompleteTextBox.Delimiter;
         StringBuilder sb = new StringBuilder();
         foreach (RadListDataItem item in this.radCheckedDropDownList1.CheckedItems)
         {
             sb.Append(item.Text + delimiter);
         }
         this.radCheckedDropDownList1.Text = sb.ToString();                              
    }