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

[Solved] RadComboBox SelectedIndex problem

1 Answer 167 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
shaun
Top achievements
Rank 1
shaun asked on 30 Jul 2009, 02:23 PM
Hi

I have two combo boxes.  When combo1's selected index changes, I want to retrieve that selected index and if that selected index equals 5 (or whatever), I want combo2's selected index to change to 1.

Example:

I have a combo box called fldIDCardDescription.  If fldIDCardDescription text equals 'DRIVER'S LICENSE' (index 5), I want the other combo box (fldState) to default to 'PENNSYLVANIA' (index 1).

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 31 Jul 2009, 06:36 AM
Hello Shown,

Have you tried following code snippet in order to select SelectedIndex for second based on first RadComboBox?

ASPX:
 
<telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged"
    <Items> 
     . . .  
    </Items> 
</telerik:RadComboBox> 
<telerik:RadComboBox ID="RadComboBox2" runat="server"
    <Items> 
     . . . 
    </Items> 
</telerik:RadComboBox> 

C#:
 
protected void RadComboBox1_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) 
    if (RadComboBox1.SelectedIndex == 5) 
    { 
        RadComboBox2.SelectedIndex = 1; 
    } 

-Shinu.
Tags
ComboBox
Asked by
shaun
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or