After binding the data, what do I do when I automatically empty the text in the raddropdownlist control as soon as I type the wrong option?
I used the following code to customize the raddropdownlist control, but it didn't work
Public Class clsHYCombo
Inherits Telerik.WinControls.UI.RadDropDownList
Public Property RestrictContentToListItems As Boolean = True
Protected Overrides Sub OnValidating(e As System.ComponentModel.CancelEventArgs)
If RestrictContentToListItems AndAlso Me.Items.Count > 0 Then
Dim index As Integer = Me.FindString(Me.Text)
If index > -1 Then
Me.SelectedIndex = index
Else
e.Cancel = True
Me.Text = ""
'Beep()
End If
End If
MyBase.OnValidating(e)
End Sub
'Protected Overrides Sub OnKeyPress(ByVal e As KeyPressEventArgs)
' MyBase.OnKeyPress(e)
' If RestrictContentToListItems AndAlso Me.Items.Count > 0 Then
' Dim index As Integer = Me.FindString(Me.Text)
' If index > -1 Then
' Me.SelectedIndex = index
' Else
' Me.Text = ""
' 'Beep()
' End If
' End If
'End Sub
'Protected Overrides Sub OnTextChanged(ByVal e As EventArgs)
' MyBase.OnTextChanged(e)
' If RestrictContentToListItems AndAlso Me.Items.Count > 0 Then
' Dim index As Integer = Me.FindString(Me.Text)
' If index > -1 Then
' Me.SelectedIndex = index
' Else
' Me.Text = ""
' 'Beep()
' End If
' End If
'End Sub
End Class