RadComboBox loadondemand resets position when data is fetched.

3 posts, 0 answers
  1. Leon
    Leon avatar
    11 posts
    Member since:
    Jan 2014

    Posted 01 Jul 2014 Link to this post


    As stated in the title, the position keeps resetting to the 1st element in the combobox as soon as new data is added to the combobox.  Below is the itemrequested code I use.

    Protected Sub cboInstrument_ItemsRequested(ByVal sender As Object, ByVal e As RadComboBoxItemsRequestedEventArgs)
            Dim oSender As Telerik.Web.UI.RadComboBox = DirectCast(sender, Telerik.Web.UI.RadComboBox)
            oSender.DataValueField = "Name"
            oSender.DataTextField = "Name"
            Dim data As List(Of Instrument)
            If Not String.IsNullOrWhiteSpace(ExchangeComboBox.SelectedValue) Then
                data = GetData(ExchangeComboBox.SelectedValue, e.Text, False)
                Dim itemOffset As Integer = e.NumberOfItems
                Dim endOffset As Integer = Math.Min(itemOffset + ItemsPerRequest, data.Count)
                'e.EndOfItems = endOffset = IIf(data.Count = 1, 0, data.Count)
                e.EndOfItems = endOffset = data.Count
                For i As Integer = itemOffset To endOffset - 1
                    oSender.Items.Add(New RadComboBoxItem(String.Format("{0} - {1}", data(i).Symbol, data(i).Name), data(i).ExchangeSymbolKey))
                e.Message = GetStatusMessage(endOffset, data.Count)
                Dim endOffset As Integer = 0
                oSender.Items.Add(New RadComboBoxItem("Select an Exchange", Nothing))
                e.Message = GetStatusMessage(endOffset, 0)
            End If
        Catch exc As Exception
            ProcessModuleLoadException(Me, exc)
        End Try
    End Sub

    Any help will be greatly appreciated.

  2. Aneliya Petkova
    Aneliya Petkova avatar
    207 posts

    Posted 04 Jul 2014 Link to this post

    Hello Leon,

    In order to assist you in the most efficient way I would kindly suggest you to open a new support ticket and provide us with a simple runnable project which we can inspect and debug.
    Could you please check if you get any JavaScript errors in your browser developer tool?
    As far as I can see, you set an Integer value to EndOfItems property, but it should be a Boolean value.
    Please check the example in this help article in order to see how you can modify the code part with calculating endOffset and setting EndOfItems.
    You could also view the source of our RadComboBox LoadOnDemand online demos.

    Aneliya Petkova

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

  3. DevCraft R3 2016 release webinar banner
  4. Leon
    Leon avatar
    11 posts
    Member since:
    Jan 2014

    Posted 18 Jul 2014 Link to this post


    Turns out the "selectFirstMatch" option moved it to the top of the list if you filter the list.
Back to Top