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

ComboBox Load On Demand On Prerender

1 Answer 126 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
rupraj51
Top achievements
Rank 1
rupraj51 asked on 01 Jun 2012, 06:30 PM
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

1 Answer, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 05 Jun 2012, 12:51 PM
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.
Tags
ComboBox
Asked by
rupraj51
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Share this question
or