This is a migrated thread and some comments may be shown as answers.
RadDropDown Autocomplete Options
18 Answers 487 Views
This is a migrated thread and some comments may be shown as answers.
Dean
Top achievements
Rank 2
Dean asked on 09 Dec 2010, 12:40 PM
Good Day,

I would like to know if there is any way I would be able to have the RadDropDown Control have an autocomplete mode of suggestappend but with having a contains filter instead of a starts with filter as it is currently. If there is no option for this I would like to put this forward as a suggestion.

Thank You.

18 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 09 Dec 2010, 03:22 PM
Hi Dean,

There is a way to change it, but from a quick test, it won't work very well. Type one character and it will find the first item containing that letter, but ofcourse, as you continue to type, it has already completed the first part of the newly suggested word. This will give you some ideas and I'll have a look at it again as soon as I get time.

Hope this helps
Richard

Imports Telerik.WinControls.UI
Imports Telerik.WinControls
  
Public Class Form1
  
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  
  
        Dim people As New List(Of person)
        people.Add(New person("Richard", "Slade", "RichardS"))
        people.Add(New person("Brian", "Blessed", "BrianB"))
        people.Add(New person("Ian", "Hislop", "IanH"))
        people.Add(New person("Paul", "Daniels", "PaulB"))
        people.Add(New person("Dave", "Lister", "DaveL"))
        people.Add(New person("Arnold", "Rimmer", "ArnoldR"))
  
  
  
        Me.RadDropDownList1.DataSource = people
        Me.RadDropDownList1.DisplayMember = "FirstName"
        Me.RadDropDownList1.ValueMember = "UserName"
  
        Me.RadDropDownList1.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown
        Me.RadDropDownList1.AutoCompleteDataSource = people
        Me.RadDropDownList1.AutoCompleteMode = AutoCompleteMode.Append
  
        Me.RadDropDownList1.DropDownListElement.AutoCompleteAppend = New MyAutoCompleteAppendHelper(Me.RadDropDownList1.DropDownListElement)
  
        Me.RadDropDownList1.Focus()
    End Sub
End Class
  
Public Class MyAutoCompleteAppendHelper
    Inherits AutoCompleteAppendHelper
  
    Public Sub New(ByVal owner As RadDropDownListElement)
        MyBase.New(owner)
    End Sub
  
    Protected Overrides Function DefaultCompare(ByVal item As Telerik.WinControls.UI.RadListDataItem) As Boolean
        'Return MyBase.DefaultCompare(item)
        Return item.Text.Contains(MyBase.FindString)
    End Function
End Class
  
Public Class person
    Private m_UserName As String
    Private m_FirstName As String
    Private m_LastName As String
  
    Public Sub New()
    End Sub
  
    Public Sub New(ByVal firstName As String, ByVal lastName As String, ByVal userName As String)
        m_FirstName = firstName
        m_LastName = lastName
        m_UserName = userName
    End Sub
  
    Public Property FirstName() As String
        Get
            Return m_FirstName
        End Get
        Set(ByVal value As String)
            m_FirstName = value
        End Set
    End Property
  
    Public Property LastName() As String
        Get
            Return m_LastName
        End Get
        Set(ByVal value As String)
            m_LastName = value
        End Set
    End Property
  
    Public Property UserName() As String
        Get
            Return m_UserName
        End Get
        Set(ByVal value As String)
            m_UserName = value
        End Set
    End Property
  
End Class
0
Dean
Top achievements
Rank 2
answered on 10 Dec 2010, 12:53 PM
Thank you for the reply Richard, you've helped me out alot already.
0
ajpetersen
Top achievements
Rank 1
answered on 11 May 2011, 04:46 PM
Has Telerik come out with a easier way to do this?  I would like my users to be able to filter by contains instead of starts with.  I know this feature is available with the RadComboBox for aspx pages. I am now looking for one for winforms. Thanks.

Edit: I just found this:
Filtering
Telerik DropDownList and ListControl allow you to filter data by applying a pre-defined filter pattern. The user can filter the combobox items in order to easily find what he/she is searching for. The controls can be configured to filter the items that start with the specified text, or the items that contain the specified text

Anyone know how to do this? I have been through the properties a few times and I don't see anything
0
Stefan
Telerik team
answered on 12 May 2011, 10:02 AM
Hello Claude,

Thank you for writing.

Currently, we do not offer another way of doing this, but the one that Richard have used. I think that it covers your scenario as well.

Should you have any other questions, do not hesitate to contact us.

Kind regards,
Stefan
the Telerik team
Get started with RadControls for WinForms with numerous videos and detailed documentation.
0
Karl
Top achievements
Rank 1
answered on 04 Apr 2012, 03:10 PM
Hi,
I was just wondering if Telerik have updated this control to include this? I've tried the sample below, but like Richard says it selects the first match and you can't go any further.

Thanks
0
Peter
Telerik team
answered on 05 Apr 2012, 11:26 AM
Hello,

Thank you for writing.

In Q3 2011 SP1 we introduced a new property named SuggestMode that manages the AutoCompleteSuggest behavior:
radDropDownList1.DropDownListElement.AutoCompleteSuggest.SuggestMode = SuggestMode.Contains

Do not hesitate to contact us if you have other questions.

Greetings,
Peter
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Karl
Top achievements
Rank 1
answered on 05 Apr 2012, 12:16 PM
Thanks
0
Calvin
Top achievements
Rank 1
answered on 15 Jun 2012, 01:28 PM
Thanks Peter, that's a very helpful enhancement.

But can we easily set AutoCompleteAppend so that the Contains matches are appended as well?  For example, if I have an item in the list called "Client's Other Project" and I start typing "Oth", the "Client's Other Project" item will be suggested, but will not end up in the text box portion when I press tab or enter.  Instead, "Oth" remains in the text box.
0
Peter
Telerik team
answered on 20 Jun 2012, 09:33 AM
Hi Calvin,

Thank you for writing.

The requested functionality concerns AutoCompleteMode.Suggest functionality rather than AutoCompleteMode.Suggest. Once you type in "oth" you want to have the whole item suggested and the "oth" text to remain in the text box. If so, this can be achieved by using the code that I provided in my previous post.

Greetings,
Peter
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Calvin
Top achievements
Rank 1
answered on 20 Jun 2012, 05:21 PM
The requested functionality concerns AutoCompleteMode.Suggest functionality rather thanAutoCompleteMode.Suggest. 
Is this a typo?

Once you type in "oth" you want to have the whole item suggested and the "oth" text to remain in the text box. 
Unfortunately, no.  That is the behavior that I am currently seeing.

I would like:
  • Type "Oth"
  • Item "Client's Other Project" is suggested
  • Press tab
  • Text box should contain "Client's Other Project" (currently, the text box contains "Oth")

Basically, I am looking for something like AppendMode.Contains to match the new SuggestMode.Contains functionality.
0
Peter
Telerik team
answered on 25 Jun 2012, 10:47 AM
Hello Calvin,

Thank you for the clarifications.

Yes this is a typo we actually mean "AutoCompleteMode.Suggest functionality rather than AutoCompleteMode.Append".

As far as I understand, you want to see in the suggest popup "Client's Other Project" and all other items that contain "Oth". Pressing the TAB (currently you should use the arrow keys) will set the first item and cursor will be placed at the end of the text.

From steps above we considered that this functionality is close to existing Suggest functionality and SuggestMode set to Contains (except the support for TAB button which is used usually for navigation between controls on the form). You can handle the TAB key (only with RadDropDown inheritor) and select the first item from the AutoComplete Popup. Please refer to the sample code:

public class MyDropDown :RadDropDownList
{
        public override string ThemeClassName
        {
            get
            {
                return typeof(RadDropDownList).FullName;
            }                       
        }
 
        protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
        {
            if (keyData == Keys.Tab)
            {
                if (this.DropDownListElement.AutoCompleteSuggest.DropDownList.Items.Count>0)
                {
                    this.Text = this.DropDownListElement.AutoCompleteSuggest.DropDownList.Items[0].Text;
                }
 
            }
            return base.ProcessCmdKey(ref msg, keyData);
}

I hope this helps.

All the best,
Peter
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Karl
Top achievements
Rank 1
answered on 28 Jun 2012, 12:59 PM
Hi,

Has anything in been changed with regards to :
radDropDownList1.DropDownListElement.AutoCompleteSuggest.SuggestMode = SuggestMode.Contains
As this has stopped working for me.

I'm using 2011.3.11.1219 dll.

When type in the dropdown no suggestions appear for me

Is there anything else that could be canceling this out?

I've just done another test, and it appears its case sensitive. I've set it to

 

 

 

 

 

 

 

radDropDownList1.CaseSensitive = false;

 

radDropDownList1.DropDownListElement.AutoCompleteSuggest.SuggestMode = SuggestMode.Contains
And that does not work

 



Thanks


0
Peter
Telerik team
answered on 03 Jul 2012, 08:45 AM
Hi Karl,

Thank you for writing.

I assume that you are upgrading from Q3 2011 to Q1 2012? In Q1 2012 we introduced an option to ignore the case in the SuggestMode.Contains mode:
radDropDownList1.DropDownListElement.AutoCompleteSuggest.SuggestMode.StringComparison = StringComparison.InvariantCultureIgnoreCase;

If setting the StringComparison property does not help please, provide us a sample project that reproduces the issue. This will allow us to investigate the case further and provide you with adequate support.

Thank you for your time and for the cooperation.

All the best,
Peter
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
keerthi
Top achievements
Rank 1
answered on 31 Jan 2017, 10:00 AM

Hi ,

I have used the suggestmode.contains for the raddropdownlist.

But there is case sensitivity issue while typing the text in the dropdownlist.

As suggested in the post I tried to use radDropDownList1.DropDownListElement.AutoCompleteSuggest.SuggestMode.StringComparison = StringComparison.InvariantCultureIgnoreCase;

But I could not find the SuggestMode.StringComparison property.

Please provide solution ..

Regards,

Keerthi

0
keerthi
Top achievements
Rank 1
answered on 31 Jan 2017, 10:15 AM

Hi,

I have just set the case sensitive property of the Raddropdownlist to false.

Its working fine now.

Regards,

Keerthi

 

0
Hristo
Telerik team
answered on 31 Jan 2017, 01:32 PM
Hi Keerthi,

Thank you for writing.

The StringComparison property is now used internally. The value of this property depends on the CaseSensitive property of the RadDropDownList which is set to false by default.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
swarupa
Top achievements
Rank 1
answered on 16 Mar 2017, 07:40 AM

Hi,
I have a radgridview with a combobox column in winforms  and the filter is autosuggestmode.contains and dropdownstyle is dropdown for the combobox column.
The code I have used for suggestmode.contains  is
 
private void gridview_CellEditorInitialized(object sender, GridViewCellEventArgs e)
        {
            RadDropDownListEditor editor = e.ActiveEditor as RadDropDownListEditor;
            if (editor != null)
            {
                RadDropDownListEditorElement element = editor.EditorElement as RadDropDownListEditorElement;
                element.AutoCompleteMode = AutoCompleteMode.Suggest;
                element.AutoCompleteSuggest.SuggestMode = SuggestMode.Contains;
              
            }
        }
DropdownList Items :
1)DAily
2)weeKLY
3)MONTHLY
Filtering is not happening in the  case :
where  entire text is typed(The case should match  with the case of the dropdownlist item.(For eg: DAily) ) in the editor area, the suggestion box down to the editor area is disappearing and when the enter key is pressed the rows are not being filtered
Filtering is happening in the case :
If I type DAILY, daily, dAILY, Daily(The case should not match  with the case of the dropdownlist item) in the editor area, the suggestion box down to the editor area is not disappearing and when the enter key is pressed the records are also being filtered properly.
Please provide me solution for this issue
Regards,
Swarupa

0
Hristo
Telerik team
answered on 16 Mar 2017, 07:58 AM
Hello Swarupa,

Thank you for writing.

I would like to point out that we strive to keep our forum threads and tickets focused on a single topic. Your question does not actually relate to the question discussed here. Please consider opening a new thread or submitting a support ticket.

Should you have further questions please do not hesitate to write back.

Regards,
Hristo
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Asked by
Dean
Top achievements
Rank 2
Answers by
Richard Slade
Top achievements
Rank 2
Dean
Top achievements
Rank 2
ajpetersen
Top achievements
Rank 1
Stefan
Telerik team
Karl
Top achievements
Rank 1
Peter
Telerik team
Calvin
Top achievements
Rank 1
keerthi
Top achievements
Rank 1
Hristo
Telerik team
swarupa
Top achievements
Rank 1
Share this question
or