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

AutoComplete SelectedIndexChanged

2 Answers 189 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 27 Mar 2012, 04:36 PM
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 Answers, 1 is accepted

Sort by
0
Michael
Top achievements
Rank 1
answered on 29 Mar 2012, 04:26 PM
bump for blocking issue.
0
Ivana
Telerik team
answered on 30 Mar 2012, 11:39 AM
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.
Tags
ComboBox
Asked by
Michael
Top achievements
Rank 1
Answers by
Michael
Top achievements
Rank 1
Ivana
Telerik team
Share this question
or