RadAutoCompleteBox - Limit characters in TextInput

3 Answers 176 Views
Forum suggestions
Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
Ohad asked on 28 Feb 2022, 12:56 PM

Hi,

I want to limit the number of characters in searchText,

my preference is to do it from the view,

And if that is not possible, I would be happy for help on how to do it from the code behind.

 

Thanks,

Dess | Tech Support Engineer, Principal
Telerik team
commented on 28 Feb 2022, 12:59 PM

Hello, Ohad,

It would be greatly appreciated if you specify the exact Telerik product that you are currently using and which is the input control for which you need to limit the characters. Thus, we would get better understanding of the precise case and the appropriate community and support engineers would gladly assist you. Thank you in advance for the provided information. I am looking forward to your reply.

3 Answers, 1 is accepted

Sort by
0
Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
answered on 28 Feb 2022, 02:03 PM
       

 

   <telerik:RadAutoCompleteBox 
                            ItemsSource="{Binding Members}" 
                            DisplayMemberPath="Name" 
                            TextSearchMode="Contains"
                            SelectionMode="Single"/>

 

 

Here I want to limit the number of characters in the input.

 

0
Martin Ivanov
Telerik team
answered on 01 Mar 2022, 07:31 AM

Hello Ohad,

To achieve your requirement you can use the TextBoxStyle property of RadAutoCompleteBox. This will allow you to set the MaxLength property of the underlying RadWatermarkTextBox.

<telerik:RadAutoCompleteBox>
    <telerik:RadAutoCompleteBox.TextBoxStyle> 
        <Style TargetType="telerik:RadWatermarkTextBox"> 
            <Setter Property="MaxLength" Value="5" /> 
        </Style> 
    </telerik:RadAutoCompleteBox.TextBoxStyle> 
</telerik:RadAutoCompleteBox> 

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
answered on 01 Mar 2022, 03:04 PM
Thank you very much for your help!
Tags
Forum suggestions
Asked by
Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
Answers by
Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
Martin Ivanov
Telerik team
Share this question
or