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
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
Edit: I just found this:
Filtering
Anyone know how to do this? I have been through the properties a few times and I don't see anything
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
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
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
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.
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
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.
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
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
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
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
Hi,
I have just set the case sensitive property of the Raddropdownlist to false.
Its working fine now.
Regards,
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
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
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