DropDown Box & text box problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • suresh Chowdary
    New Member
    • Nov 2006
    • 9

    DropDown Box & text box problem

    Hi All,

    depending upon text box entry i want to show drop down box with respective values.
    means if user enters 'ls' in the text box i want to show the values like 'she','he' in dropdown box it appears in same page.

    if text box entry other than 'ls' i want to show 'ladies', gents' in drop down box .

    one more thing i want to hide this dopdown box until they have to give the value in text box..after deciding the value i want to show this dropdown list.

    if any one help me..plz its urgent.........
  • suresh Chowdary
    New Member
    • Nov 2006
    • 9

    #2
    DropDown Box & text box problem

    Hi All,

    depending upon text box entry i want to show drop down box with respective values.
    means if user enters 'ls' in the text box i want to show the values like 'she','he' in dropdown box it appears in same page.

    if text box entry other than 'ls' i want to show 'ladies', gents' in drop down box .

    one more thing i want to hide this dopdown box until they have to give the value in text box..after deciding the value i want to show this dropdown list.

    if any one help me..plz its urgent.........

    Comment

    • sheenattt
      New Member
      • Nov 2006
      • 20

      #3
      First of all make the textbox autopostback property true.On Text_change event make dropdowllist visible and also check its value like...this is not javascript code.

      Code:
      public void TextBox_TextChanged(object sender, EventArgs e)
      {
      
      DropDownList.Visible=true;
      if(TextBox.Text=="ls")
      {
      DropDownList.Items.add("she");
      DropDownList.Items.add("he");
      }
      else
      {
      DropDownList.Items.add("ladies");
      DropDownList.Items.add("gents");
      }
      }

      Comment

      • suresh Chowdary
        New Member
        • Nov 2006
        • 9

        #4
        Hi Friend, Thx for reply

        From where i can call this function and can u give one example how to write text box with that property..and what's that arguments u have passed to this function.

        plz asap


        Originally posted by sheenattt
        First of all make the textbox autopostback property true.On Text_change event make dropdowllist visible and also check its value like...this is not javascript code.

        Code:
        public void TextBox_TextChanged(object sender, EventArgs e)
        {
        
        DropDownList.Visible=true;
        if(TextBox.Text=="ls")
        {
        DropDownList.Items.add("she");
        DropDownList.Items.add("he");
        }
        else
        {
        DropDownList.Items.add("ladies");
        DropDownList.Items.add("gents");
        }
        }

        Comment

        • sheenattt
          New Member
          • Nov 2006
          • 20

          #5
          In which language you r working in?This code is for .Net.By double clicking the Textbox you will get a default event where u can write this code.The functions are the inbuilt functions.You can try these.Bye


          Code:
          public void TextBox_TextChanged(object sender, EventArgs e)
          {
          
          DropDownList.Visible=true;
          if(TextBox.Text=="ls")
          {
          DropDownList.Items.Clear();
          DropDownList.Items.add("she");
          DropDownList.Items.add("he");
          }
          else
          {
          DropDownList.Items.Clear();
          DropDownList.Items.add("ladies");
          DropDownList.Items.add("gents");
          }
          }

          Comment

          • sheenattt
            New Member
            • Nov 2006
            • 20

            #6
            You can set the property of textbox like this.

            Code:
            void Page_Load()
            {
            TextBox.AutoPostBack=true;
            }

            Comment

            • suresh Chowdary
              New Member
              • Nov 2006
              • 9

              #7
              Hi friend am working in java...

              k anyway thx for ur help.

              Originally posted by sheenattt
              You can set the property of textbox like this.

              Code:
              void Page_Load()
              {
              TextBox.AutoPostBack=true;
              }

              Comment

              Working...