I have a RadCombo using LoadOnDemand and ShowMoreResultsBox because my RadComboBox needs to support a large data source.
I have tried, without success, to disable the MoreResultsBox when the end of the the data source is reached.
Here is what I'm doing:
I have tried, without success, to disable the MoreResultsBox when the end of the the data source is reached.
Here is what I'm doing:
| Private WithEvents ctlRadCombo As New RadComboBox() With { |
| .ID = "ctlRadCombo", |
| .EmptyMessage = "Enter some text", |
| .ShowMoreResultsBox = True, |
| .EnableViewState = False, |
| .EnableLoadOnDemand = True, |
| .AppendDataBoundItems = True, |
| .NoWrap = True, |
| .ItemRequestTimeout = 1000, |
| .Width = 350, |
| .MaxHeight = 400 |
| } |
| Private Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Init |
| pnlContents.Controls.Add(ctlRadCombo) |
| AddHandler ctlRadCombo.ItemsRequested, AddressOf ctlRadCombo_ItemsRequested |
| End Sub |
| Private Sub ctlRadCombo_ItemsRequested(ByVal sender As Object, ByVal e As RadComboBoxItemsRequestedEventArgs) |
| Dim theCombo As RadComboBox = DirectCast(sender, RadComboBox) |
| Dim maxItems As Integer |
| Dim fromRow As Integer = e.NumberOfItems + 1 |
| Dim toRow As Integer = fromRow + 9 |
| Dim items As IDictionary(Of Integer, String) = GetItemsByText(e.Text, fromRow, toRow, maxItems) |
| Dim data As IDictionary(Of Integer, String) = items |
| theCombo.DataTextField = "Value" |
| theCombo.DataValueField = "Key" |
| theCombo.DataSource = data |
| theCombo.DataBind() |
| e.EndOfItems = maxItems <= toRow |
| theCombo.ShowMoreResultsBox = Not e.EndOfItems |
| End Sub |