My "load on demand" is extremely slow. There are about 250,000 records in the table but I understood that even with this number of records the load-on-demand should have acceptable performance. Please take a look at the code here and let me know if there's a setting somewhere which I'm missing. When I click in the combobox it says "loading..." for minutes before anything shows up in the list. Thanks.
ASPX:
<telerik:RadComboBox ID="rcbProductCode" runat="server" Width="250px" Height="200px"
AllowCustomText="True" ShowToggleImage="True" ShowMoreResultsBox="true"
EnableLoadOnDemand="True" MarkFirstMatch="True"
OnItemsRequested="rcbProductCode_ItemsRequested" EnableVirtualScrolling="true" >
</telerik:RadComboBox>
VB.NET:
Protected Sub rcbProductCode_ItemsRequested(ByVal o As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs)
Dim sql As String = _
"SELECT PRODUCT = RTRIM(PRODUCT_CODE) + ' - ' + RTRIM(PRODUCT_DESC), PRODUCT_CODE " & _
"FROM AllianceSync.DBO.FDA_PRODUCT (NOLOCK) " & _
"WHERE PRODUCT_CODE like '" + e.Text + "%'"
Dim connTmp As New SqlConnection(strConnString)
connTmp.Open()
Dim adapter As New SqlDataAdapter(sql, connTmp)
Dim data As New DataTable()
adapter.Fill(data)
Dim rcb As Telerik.Web.UI.RadComboBox = CType(o, Telerik.Web.UI.RadComboBox)
Try
Dim itemsPerRequest As Integer = 10
Dim itemOffset As Integer = e.NumberOfItems
Dim endOffset As Integer = itemOffset + itemsPerRequest
If endOffset > data.Rows.Count Then
endOffset = data.Rows.Count
End If
If endOffset = data.Rows.Count Then
e.EndOfItems = True
End If
Dim i As Integer = itemOffset
While i < endOffset
rcb.Items.Add(New Telerik.Web.UI.RadComboBoxItem(data.Rows(i)("PRODUCT").ToString(), data.Rows(i)("PRODUCT_CODE").ToString()))
i = i + 1
End While
If data.Rows.Count > 0 Then
e.Message = [String].Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), data.Rows.Count.ToString())
Else
e.Message = "No matches"
End If
Catch
e.Message = "No matches"
End Try