SelectedItem Not Showing After Page Load

1 posts, 0 answers
  1. Lynn
    Lynn avatar
    186 posts
    Member since:
    Sep 2006

    Posted 12 May 2011 Link to this post

    To Telerik..................

    This item may be closed and deleted, please and thank you.  I kept working on this and discovered an erroneous .select earlier in the page load event that was setting the selected item to an incorrect item.

    Sorry to kluge up the works with a useless forum entry.

    I have a combo box (current version) that I am populating at Page Load.  The combo box definition is:

    <telerik:RadComboBox
        ID="SearchCountry"
        MarkFirstMatch="True"
        TabIndex="5"
        style="z-index: 9000;"
        Width="200px"
        EnableEmbeddedSkins="true"
        Skin="Sitefinity"
        runat="server"
        Height="150px"
        OnClientSelectedIndexChanging="aLoadSearchStateProv"
    >

    The code used to populate the combo box is:
    Dim reader As SqlDataReader = cmd.ExecuteReader()
    Do While reader.Read()
        RCBI = New RadComboBoxItem()
        RCBI.Text = Convert.ToString(reader(sFieldToPopulate))
        RCBI.Value = reader("CodeList")
        If oValueToMatch = RCBI.Value Then
            RCBI.Selected = True
        End If
        RadComboBox1.Items.Add(RCBI)
    Loop
    reader.Close()
    reader = Nothing

    Here are the pertinent facts:
    (1) The combo box is being populated correctly as far as the total entries are concerned.  See attached graphic.
    (2) I have stepped through the code and the "RCBI.Selected = True" line of code is being executed ONCE during page load and it is being executed for the correct RCBI.Value (key value of 128).  But the first item in the list is showing (the one saying "Select from this list").  Refer to the second uploaded graphic.

    Why isn't the item selected (actually the record for key value 128, United States) being displayed in the combo box display area after page load?

    Thanks in advance for your assistance?  Let me know if you need additional information and I will happily comply!

    Lynn
Back to Top