This is a migrated thread and some comments may be shown as answers.

Load on demand not working

2 Answers 42 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 24 Nov 2013, 04:45 AM
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 Answers, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 27 Nov 2013, 04:43 PM
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.
0
Steve
Top achievements
Rank 1
answered on 27 Nov 2013, 04:53 PM
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.
Tags
ComboBox
Asked by
Steve
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Steve
Top achievements
Rank 1
Share this question
or