This is a migrated thread and some comments may be shown as answers.

AutoCompleteBox and spaces

5 Answers 89 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Doug Cowperthwaite
Top achievements
Rank 1
Doug Cowperthwaite asked on 15 Apr 2013, 07:12 PM
Using 2013 Q1 controls.  I have items in the suggestion list for an AutoCompleteBox that have spaces (similar to the example in your documentation that uses first and last names).  The AutoCompleteBox ignores spaces typed in the textbox.  I can paste a partial value with spaces into the text box and the suggestion list displays the correct matching entries.  The suggestion list contains thousands of items, so first word often does not provide a close enough match.

I saw that there is another question regarding the same issue.  In that thread, it is implied that the question was answered in another thread, but the hyperlink goes to an unrelated topic. I cannot find an answer to this question by browsing or searching the forum.

5 Answers, 1 is accepted

Sort by
0
Ivan Petrov
Telerik team
answered on 18 Apr 2013, 03:47 PM
Hi Doug,

Thank you for writing.

We are aware of this issue and have it logged in our Public Issue Tracking System - PITS. You can track its progress, subscribe for status changes and add your vote/comment to it on the following link - PITS Issue. I have attached an example project where I have created a custom AutoCompleteBox that has this issue addressed. You can use it until the issue is resolved.

I hope this will be useful. Should you have further questions, I would be glad to help.

Regards,
Ivan Petrov
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
0
Doug Cowperthwaite
Top achievements
Rank 1
answered on 22 Apr 2013, 01:47 PM
The example works in Suggest mode, but does not help when using SuggestAppend.   The only downside to using Suggest mode is that it can leave untokenized, undelimited text in the control when the user tabs or clicks out of the control.  The successfully tokenized items are intact, but it is not a great visual.   Since the functionality is more important, I'll live with Suggest mode unless there is a workaround for SuggestAppend mode.
0
Ivan Petrov
Telerik team
answered on 25 Apr 2013, 12:47 PM
Hello Doug,

Thank you for writing back.

I have attached a modified version of the previous project where I have implemented a workaround that will work in both AutoCompleteModes. Although, this works in SuggestAppend the mode itself cannot guarantee you that users are not allowed to enter random text and to tab out.

I hope this will help. Do not hesitate to write back with further questions.

All the best,
Ivan Petrov
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
0
Doug Cowperthwaite
Top achievements
Rank 1
answered on 25 Apr 2013, 01:35 PM
Thanks. That works great.

I've gotten around the problem with random text being entered by calling this from the Validated event on the control.  It removes the untokenized text by rebuilding the text from the tokenized elements.  The only interesting behavior is that the tokenized elements are alphabetized, so the order of the items may change when the user tabs out of the control.  That is not totally undesired in this case.

public void RemoveUntokenizedText(object sender, EventArgs e)
{
    ucRadAutoCompleteBox ctl = (ucRadAutoCompleteBox) sender;
 
    if (!String.IsNullOrEmpty(ctl.Text))
    {
        string newText = "";
        //RadTokenizedTextItemCollection oldItems = ctl.Items;
        //ctl.Clear();
 
        foreach (RadTokenizedTextItem i in ctl.Items)
        {
            newText += i.Text + ";";
        }
        ctl.Text = newText;
    }
}
0
Ivan Petrov
Telerik team
answered on 29 Apr 2013, 01:41 PM
Hi Doug,

Thank you for your reply.

I am glad we have been able to find a solution to your problem.

Feel free to write back with further questions.

Regards,
Ivan Petrov
the Telerik team
WinForms Q1 2013 boasts PivotGrid, PDF Viewer, Chart enhancements and more. Check out all of the latest highlights.
Tags
AutoCompleteBox
Asked by
Doug Cowperthwaite
Top achievements
Rank 1
Answers by
Ivan Petrov
Telerik team
Doug Cowperthwaite
Top achievements
Rank 1
Share this question
or