AutoComplete when entering Chinese

1 Answer 61 Views
AutoCompleteBox DropDownList
lou
Top achievements
Rank 1
lou asked on 07 Jul 2023, 08:23 AM

Hi,

When the Chinese input method is used, a Chinese word is generated after the space key is pressed. For example, if you enter j, i, a, n, c, h, a, and then press space, you will get "检查". I want to filter "检查" as a filter word. What should I do? Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Dinko | Tech Support Engineer
Telerik team
answered on 12 Jul 2023, 06:51 AM

Hi lou jason,

To filter the control you can use its filter functionality. You can read more about it in the RadDropDownList Filtering article. In your case, I am not sure how to catch the moment when the user presses Space to autocomplete the word. One approach which comes to my mind is to subscribe to the TextChanged event of the TextBox inside the control. If the text matches a specific word, filter the control. Here is what I have in mind.

public Form1()
{
    InitializeComponent();
    this.radDropDownList1.DropDownListElement.TextBox.TextChanged += TextBox_TextChanged;
}

private void TextBox_TextChanged(object sender, EventArgs e)
{
    if (this.radDropDownList1.DropDownListElement.TextBox.Text == "检查")
    {
        this.radDropDownList1.Filter = FilterItem;
    }
}

private bool FilterItem(RadListDataItem item)
{
    if (item.Text.Contains("检查"))
    {
        return true;
    }
    return false;
}

You can also see how it is working on my side:

I hope that this approach will work for you.

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
AutoCompleteBox DropDownList
Asked by
lou
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or