Problem with dropdown list

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mathewgk80
    New Member
    • Sep 2007
    • 103

    Problem with dropdown list

    Hi everybody,

    I am having a drop down list with items 1,2,3.. and another dropdown list with items apple,orange and lemon..

    If i select item 2 in the first dropdown list i need to get orange as the selected item in the second dropdown list.

    if i select item 3 in the first drop down list, i need to get lemon in the second drop down list automatically.. .

    I am using asp.net and c#.net....
    Please help me..

    Regards,
    Mathew..
  • jeenajos
    New Member
    • Oct 2007
    • 71

    #2
    Hi,
    I think u can specify an select--case for doing that.
    Wen u select one item,the corresponding second item wil be selected in ur second dropdownlist.
    Another option is to give a if condition.
    Try it...

    Thanks Jeen

    Comment

    • aliasruel
      New Member
      • Sep 2007
      • 73

      #3
      HI,

      You dont have to write the "IF" or "SELECT CASE" code to test each selected value..
      all you have to do is to set the Autopostback property of the dropdownlist1 equal to TRUE.... then put this code in the dropdownlist1 DropDownList1_S electedIndexCha nged handler:

      private void DropDownList1_S electedIndexCha nged(object sender, System.EventArg s e)
      {
      this.DropDownLi st2.SelectedInd ex=this.DropDow nList1.Selected Index;
      }

      Best Regards,
      Ruel

      =============== =============== =============== ===========










      Originally posted by mathewgk80
      Hi everybody,

      I am having a drop down list with items 1,2,3.. and another dropdown list with items apple,orange and lemon..

      If i select item 2 in the first dropdown list i need to get orange as the selected item in the second dropdown list.

      if i select item 3 in the first drop down list, i need to get lemon in the second drop down list automatically.. .

      I am using asp.net and c#.net....
      Please help me..

      Regards,
      Mathew..

      Comment

      • jeenajos
        New Member
        • Oct 2007
        • 71

        #4
        Originally posted by aliasruel
        HI,

        You dont have to write the "IF" or "SELECT CASE" code to test each selected value..
        all you have to do is to set the Autopostback property of the dropdownlist1 equal to TRUE.... then put this code in the dropdownlist1 DropDownList1_S electedIndexCha nged handler:

        private void DropDownList1_S electedIndexCha nged(object sender, System.EventArg s e)
        {
        this.DropDownLi st2.SelectedInd ex=this.DropDow nList1.Selected Index;
        }

        Best Regards,
        Ruel

        =============== =============== =============== ===========

        This information is very valuable for me too... U specified the solution with one line itself. Thank U.

        Jeen

        Comment

        • mathewgk80
          New Member
          • Sep 2007
          • 103

          #5
          Originally posted by aliasruel
          HI,

          You dont have to write the "IF" or "SELECT CASE" code to test each selected value..
          all you have to do is to set the Autopostback property of the dropdownlist1 equal to TRUE.... then put this code in the dropdownlist1 DropDownList1_S electedIndexCha nged handler:

          private void DropDownList1_S electedIndexCha nged(object sender, System.EventArg s e)
          {
          this.DropDownLi st2.SelectedInd ex=this.DropDow nList1.Selected Index;
          }

          Best Regards,
          Ruel

          =============== =============== =============== ===========
          Hi Ruel,

          Thank a lot for your valuable information...

          Regards,

          Mathew

          Comment

          Working...