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

Two combo boxes and SelectedIndexChanged

3 Answers 82 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
berto
Top achievements
Rank 1
berto asked on 20 Aug 2012, 10:50 PM
Hello,
How to implement two combo boxes one with Customer ID and second with Visible Customer name (as value as well ID) with following functionality:

1. If one is chosen information about customer are displayed
2. If after choosing one someone clicked second one, first one should return do starting state (nothing chosen) and customer should be displayed based on clicked combo box etc.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 21 Aug 2012, 06:10 AM
Hi Berto,

You can clear the items of first combobox in SelectedIndexChanged event of the second combobox. Here is the sample code.
C#:
protected void RadComboBox2_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
{
RadComboBox1.EmptyMessage = "please select an item";
RadComboBox1.ClearSelection();
}

Thanks,
Princy.
0
berto
Top achievements
Rank 1
answered on 21 Aug 2012, 07:43 AM
I tried this allready and it does not work:

My code:

protected void ddlPatientSuchwort2_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
{
    int varPatient = int.Parse(ddlPatientSuchwort2.SelectedValue);
 
        ddlPublicNummer2.EmptyMessage = "Patient Nummer";
        ddlPublicNummer2.ClearSelection();
        this.getWinacsPatient(varPatient);
 
}
 
protected void ddlPublicNummer2_SelectedIndexChanged(object sender, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e)
{
    int varPatient = int.Parse(ddlPublicNummer2.SelectedValue);
 
        ddlPatientSuchwort2.EmptyMessage = "Patient Name";
        ddlPatientSuchwort2.ClearSelection();
        this.getWinacsPatient(varPatient);
 
 
}

If I change second DDL first one still shows last choosen value...
0
berto
Top achievements
Rank 1
answered on 21 Aug 2012, 08:28 AM
I solved this issue with following:

radcombobox.text = "":
radcombobox.ClearSelection();

I have one more question how to check if ComboBox was not touched at all?
Tags
ComboBox
Asked by
berto
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
berto
Top achievements
Rank 1
Share this question
or