AutoComplete SelectedIndexChanged

3 posts, 0 answers
  1. Michael
    Michael avatar
    31 posts
    Member since:
    Dec 2011

    Posted 27 Mar 2012 Link to this post

    Hi, 

    I am trying to get the value for the currently selected item when the SelectedIndexChanged event is fired. Currently, The SelectedValue is "" and the SelectedIndex is -1.  The text is not always unique (due to backwards compatibility) so this cannot be used reliably.  There is also no useable information in the event object.

    What gives?  How am i supposed to use auto complete and get the selected value?  Also, the whole point of this is for the user to not have to click a button to submit it.

    As a side note i am quite surprised there is no SelectedValueChanged event (but this is an aside).

    <telerik:RadComboBox
        ID="comboBoxGroupSelection"
        runat="server"
        EmptyMessage="Search for a group"
        MarkFirstMatch="True"
        AllowCustomText="False"
        MaxHeight="300"
         OnSelectedIndexChanged="comboBoxGroupSelection_SelectedIndexChanged"
        AutoPostBack="True"> </telerik:RadComboBox>

    Private Sub bindGroups()
     
            Dim Group As New Groups
     
            Dim resultSet As DataSet = Group.GetItems(xmlFile.DBConnect)
            Dim resultView As DataView = resultSet.Tables(0).AsDataView()
            resultView.Sort = "createdDt desc"
            comboBoxGroupSelection.DataValueField = "id"
            comboBoxGroupSelection.DataTextField = "name"
            comboBoxGroupSelection.DataSource = Group.GetItems(xmlFile.DBConnect)
            comboBoxGroupSelection.DataBind()
     
     
        End Sub
     
        Protected Sub comboBoxGroupSelection_SelectedIndexChanged(ByVal Sender As Object, ByVal e As Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs)
     
     
           AddGroup(**SELECTEDVALUEHERE**)
     
        End Sub
  2. Michael
    Michael avatar
    31 posts
    Member since:
    Dec 2011

    Posted 29 Mar 2012 Link to this post

    bump for blocking issue.
  3. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 30 Mar 2012 Link to this post

    Hi Michael,

    I have tested the following scenario (which is almost like yours) locally:
    <telerik:RadComboBox ID="RadComboBox1" runat="server" EmptyMessage="Search for a group"
        MarkFirstMatch="True" AllowCustomText="False" MaxHeight="300" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged"
        AutoPostBack="True" DataSourceID="SqlDataSource2" DataTextField="VehicleName" DataValueField="ID">
    </telerik:RadComboBox>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
        SelectCommand="SELECT * FROM Vehicles" />
    When you try to autocomplete an item  into the input area of RadComboBox the SelectedIndexChanged server event is fired as it should. Its second argument (RadComboBoxSelectedIndexChangedEventArgs) does hold information about the currently selected item and the previously selected one. I am missing something?

    If you continue to have troubles with this scenario could you open a support ticket and send us a sample project of this behavior along with information about the version of RadControls that you use?

    Kind regards,
    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