ComboBox Load On Demand On Prerender

2 posts, 0 answers
  1. rupraj51
    rupraj51 avatar
    4 posts
    Member since:
    Jan 2007

    Posted 01 Jun 2012 Link to this post

    Hi,

    I have a radcombobox which gets bind on the prerender event of the update panel which is its parent.

    I have these properties set on the combobox
    EnableLoadOnDemand="True"
    ShowMoreResultsBox="True"
    MarkFirstMatch="true"
    EnableVirtualScrolling="true"
    EmptyMessage="--- Choose ---"

    After the initial load of the combobox the showmoreresultsbox does not show anything but just a dropdown arrow. After i type something in the combobox and when it filters it shows "Items 1-2 out of 2"

    How can i get the text on the showmoreresultsbox on the initial load. I have these methods in my code behind file:

        Private Function GetData(ByVal test As String) As DataView
            Dim NewDataview As DataView

            NewDataview = DataViewTest

            NewDataview.RowFilter = "ElementName LIKE '" + test + "%'"

            Return NewDataview
        End Function

        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

        Protected Sub ddlElements_ItemsRequested(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs) Handles ddlElements.ItemsRequested

            Dim data As DataTable = GetData(e.Text).ToTable

            Dim itemOffset As Integer = e.NumberOfItems
            Dim endOffset As Integer = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count)
            e.EndOfItems = endOffset = data.Rows.Count

            ddlElements.Items.Clear()


            For i As Integer = itemOffset To endOffset - 1
                ddlElements.Items.Add(New RadComboBoxItem(data.Rows(i)("ElementName").ToString(), data.Rows(i)("GroupID").ToString()))
            Next

            e.Message = GetStatusMessage(endOffset, data.Rows.Count)
        End Sub
  2. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 05 Jun 2012 Link to this post

    Hi Rupesh,

    The arrow in the MoreResultBox should be shown only when no message is specified which, as I have inspected your code, is not your case. Could paste here the whole markup of RadComboBox as well as some other code that might be related to this behavior?

    Also could you specify the version of RadControls for ASP.NET AJAX that you use in your application?

    Greetings,
    Ivana
    the Telerik team
    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 their blog feed now.
Back to Top