SelectedItem and SelectedValue break with too many items?

2 posts, 0 answers
  1. Brian
    Brian avatar
    14 posts
    Member since:
    Sep 2012

    Posted 18 Mar 2013 Link to this post

    I am using a RadComboBox for item selection on a page in my web application.  The box is loaded with possible selections based on the currently logged in user.  I was running into an issue where no matter what item I select in the RadComboBox, the SelectedValue is always -1 and the SelectedIndex is always 0 no matter which item I select, while the Text property is accurate.  I searched many posts and saw possibilities surrounding page postback but I am checking for a Not Postback before loading the box.  My RadComboBox is on the page as follows:

    <telerik:RadComboBox ID="rcbRetailProducer" runat="server" Width="224px"
         EnableLoadOnDemand="false" HighlightTemplatedItems="true"
         MarkFirstMatch="true" ForeColor="black" BackColor="white" AllowCustomText="false"

    In the Code behind in the PageLoad event I have"

    If Not Page.IsPostBack Then
    End If

    And within the PopulateFormFields code block I have:
    Dim retailDS As New DataSet
    Me.rcbRetailProducer.DataSource = retailDS.Tables(0)
    Me.rcbRetailProducer.DataTextField = "Name"
    Me.rcbRetailProducer.DataValueField = "Value"
    Me.rcbRetailProducer.Items.Insert(0, New RadComboBoxItem(" ", "-1"))

    The RadComboBox gets filled with all possibilities, but no matter what I select when I place a break in my code and check the SelectedValue and SelectedIndex properties, SelectedValue is -1 and SelectedIndex is 0

    There are a small handful of users in the system that have large amounts of data that can be loaded into this box, to the tune of around 2,000 - 2,500 records.  Aside from these very few users, the rest of the user base has maybe a few hundred.  I modified the procedure that loads the retailDS dataset shown above to return only 10 records, and when I did that everything works fine!! So, can the radcombobox not handle large lists?  If not, what is the max?  Right now if this RadComboBox returns 2500 records then SelectedValue and SelectedIndex never hold the proper value....but they work fine with the exact same code if I limit the dataset to less records.
  2. Nencho
    Nencho avatar
    1858 posts

    Posted 21 Mar 2013 Link to this post

    Hello Brian,

    Since you had assigned a DataSource and you are manually adding a RadComboBoxItem, I can suggest you to set the AppendDataBoundItems to true, like it is suggested in this help article. Persisting all the items correctly, should fix the faced issue with the SelectedValue. In addition, I have performed some tests locally and you could observe the result in this video.

    All the best,
    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