I have a Rad combo box that when you type it starts completing sentences instead of just marking the one that is most similar.
<
telerik:RadComboBox
ID
=
"rcbSiteSearch"
runat
=
"server"
Width
=
"190px"
Height
=
"100px"
EnableLoadOnDemand
=
"True"
ShowMoreResultsBox
=
"true"
MarkFirstMatch
=
"true"
AllowCustomText
=
"true"
EnableVirtualScrolling
=
"true"
OnItemsRequested
=
"rcbSiteSearch_ItemsRequested"
/>
Protected
Sub
rcbSiteSearch_ItemsRequested(
ByVal
sender
As
Object
,
ByVal
e
As
RadComboBoxItemsRequestedEventArgs)
Const
ItemsPerRequest
As
Integer
= 5
Dim
data
As
DataTable = GetSiteName(e.Text)
Dim
itemOffset
As
Integer
= e.NumberOfItems
Dim
endOffset
As
Integer
= Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count)
e.EndOfItems = endOffset = data.Rows.Count
For
i
As
Integer
= itemOffset
To
endOffset - 1
rcbSiteSearch.Items.Add(
New
RadComboBoxItem(data.Rows(i)(
"name"
).ToString(), data.Rows(i)(
"value"
).ToString()))
Next
e.Message = GetStatusMessage(endOffset, data.Rows.Count)
End
Sub
Private
Shared
Function
GetSiteName(
ByVal
text
As
String
)
As
DataTable
Dim
StateCode
As
String
=
"pa"
Dim
connectionString
As
String
= *Connection
String
*
Dim
QueryStr
As
String
= *QUERY*
Dim
adapter
As
New
SqlDataAdapter(QueryStr,connectionString)
Dim
Data
As
New
DataTable()
Try
adapter.Fill(Data)
Catch
ex
As
Exception
Call
MsgBox(
String
.Format(
"Unexpected Error: {0}"
, ex.ToString()), 0,
"Unexpected Search Error"
)
End
Try
Return
Data
End
Function
Private
Shared
Function
GetStatusMessage(
ByVal
offset
As
Integer
,
ByVal
total
As
Integer
)
As
String
If
total <= 0
Then
Return
"No matches"
End
If
Return
[
String
].Format(
"Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>"
, offset, total)
End
Function