Load on demand not working

3 posts, 0 answers
  1. Steve
    Steve avatar
    84 posts
    Member since:
    Aug 2013

    Posted 23 Nov 2013 Link to this post

    The load on demand for the combobox is not working once I move the page to the shared host. It works fine while testing it in Visual Studio.
    Up on the shared host, when I click on the combobox, it drops down showing the items in the box. But, as soon as I type a single letter, the "Loading..." message appears and it just sits there. Even if I type the first letter of the first item in the box, it will show the loading message and then do nothing.

    I tried both loading from server side, and also by setting the EnableAutomaticLoadOnDemand="true". The latter doesn't even load the list.

    This will at least display the list:

    <telerik:RadComboBox ID="CustomerSearch" runat="server" Width="180" Height="160"
        MarkFirstMatch="true"  AllowCustomText="true" CssClass="CustomerSearch"
        EnableLoadOnDemand="true" EnableVirtualScrolling="true" OnItemsRequested="CustomerSearch_ItemsRequested"
         OnClientSelectedIndexChanged="searchnav" EmptyMessage="Select a customer" DataSourceID="dsCustomer" DataTextField="CustomerName"
        DataValueField="NavPath" BackColor="White" Skin="Forest" />
      
    <asp:SqlDataSource ID="dsCustomer" runat="server"
        SelectCommand="CustomerSearchName" SelectCommandType="StoredProcedure">
    </asp:SqlDataSource>
     
     
    <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
        <script type="text/javascript">
            function searchnav(sender, args) {
                var iframe = document.getElementById('ctl00_iMainPages');
                iframe.src = sender.get_value();
            }
     
        </script>
    </telerik:RadScriptBlock>


    This is the code-behind:

    Protected Sub CustomerSearch_ItemsRequested(sender As Object, e As RadComboBoxItemsRequestedEventArgs)
        Dim dal As New Customer
     
        Dim data As DataTable = dal.CustomerSearchName(Session("StoreID"), e.Text).Tables(0)
     
        Dim itemOffset As Integer = e.NumberOfItems
        Dim endOffset As Integer = Math.Min(itemOffset + 10, data.Rows.Count)
        e.EndOfItems = endOffset = data.Rows.Count
     
        For i As Integer = itemOffset To endOffset - 1
            CustomerSearch.Items.Add(New RadComboBoxItem(data.Rows(i)("CustomerName").ToString(), data.Rows(i)("NavPath").ToString()))
        Next
     
        e.Message = GetStatusMessage(endOffset, data.Rows.Count)
    End Sub
    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
  2. Dimitar Terziev
    Admin
    Dimitar Terziev avatar
    1266 posts

    Posted 27 Nov 2013 Link to this post

    Hello Steve,

    If the control is not populated after the request for items is initiated, the most common reason is a server error during the item retrieval. Could you check for errors using the developer tools of the browser that you are using?

    Regards,
    Dimitar Terziev
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Steve
    Steve avatar
    84 posts
    Member since:
    Aug 2013

    Posted 27 Nov 2013 Link to this post

    How do I check for errors using the developer tools of the browser? I'm currently using Firefox, as IE 11 is not working properly for me (I have a ticket open for that).

    When I click on the dropdown combobox initially, it is loaded with the data. It's the load on demand, I believe that is not working for some reason.  That is server side, obviously. So how do I troubleshoot that on a hosted server? It's working fine in my local development environment.
Back to Top