Two combo boxes and SelectedIndexChanged

4 posts, 0 answers
  1. berto
    berto avatar
    40 posts
    Member since:
    Jul 2012

    Posted 20 Aug 2012 Link to this post

    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.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 21 Aug 2012 Link to this post

    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.
  3. berto
    berto avatar
    40 posts
    Member since:
    Jul 2012

    Posted 21 Aug 2012 Link to this post

    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...
  4. berto
    berto avatar
    40 posts
    Member since:
    Jul 2012

    Posted 21 Aug 2012 Link to this post

    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?
Back to Top