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

How to make AJAX RadAutoCompleteBox search case insensitive?

1 Answer 168 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Quintin
Top achievements
Rank 1
Quintin asked on 23 Jan 2014, 09:58 AM
Hey Guys,

The problem I am having is that the filtering functionality of the AutoCompleteBox is case sensitive.

I have names stored in the database with an uppercase first letter, so if a user enters a lower case letter into the autocompletebox, it does not display any results.

I have searched for properties within the control itself to work around this, but there seems to be none.  Is there a way to handle the filtering method myself in the server code, or even the client?

I'm implementing a RadAutoCompleteBox to search through a list of items bound to the control using a LinqDataSource.

In the LinqDataSource, I am use the onselecting event to fetch the data.

protected void LinqDataSourceForAutoComplete_OnSelecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            using (DataClassesDataContext dc = new DataClassesDataContext())
            {
                var membersUsers = (from ue in dc.UserEntities
                    join boe in dc.BusinessOwnerEntities on ue.ID equals boe.UserEntity.ID into j1
                    from j2 in j1.DefaultIfEmpty()
                    where j2 != null
                    select new
                    {
                        ID = ue.ID,
                        Description =
                            string.Format("{0}, {1}", ue.Surname,
                                ue.PreferredName != null ? ue.PreferredName : ue.FirstName)
                    }).ToList();
                e.Result = membersUsers;
            }
        }

and here is the markup for the RadAutoCompleteBox

<telerik:RadAutoCompleteBox runat="server" ID="RadAutoCompleteBox1
                                DataSourceID="LinqDataSourceForAutoComplete
                                DataValueField="ID" 
                                DataTextField="Description"
                                InputType="Token"
                                TextSettings-SelectionMode="Single"
                                Filter="Contains"
                                >
                            </telerik:RadAutoCompleteBox>

Any help on how I could get around this would be greatly appreciated!

1 Answer, 1 is accepted

Sort by
0
Kate
Telerik team
answered on 27 Jan 2014, 12:26 PM
Hello Quintin,

I tested the scenario that you describe (with this demo) and I could get the entry whose text I typed in the input of the control(check the attached image).

Regards,
Kate
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the UI for ASP.NET AJAX, subscribe to the blog feed now.
Tags
AutoCompleteBox
Asked by
Quintin
Top achievements
Rank 1
Answers by
Kate
Telerik team
Share this question
or