DropDownList(ddlist) and TextBox(tbox)

Discussion in 'ASP .Net Web Controls' started by deepak, Dec 12, 2005.

  1. deepak

    deepak Guest

    i have dropdownlist(ddlist) and textbox(tbox) , i want that if a user types
    sometihing in the
    textbox(tbox), the values present in the ddlist should appear e.g.
    my ddlist has 3 values (india,indonesia,germany), if user types in text box
    like "i" then dropdown
    control should go to "india" and 'indonesia" (not to germany) and if he
    types "n" the then it be on india,indonesia
    and if he types "d" after "in" in text box then control should be on "india"
    ,indonesia" and if he types 4th letter
    say "i" then control shoudl select 2nd value which is "india",in this way
    the procseesing should be done..there must be no postback, i know it can be
    done with the help of javsscript but how..plz help me ,Thnaks in adavce to
    everyone who will try to do this
     
    deepak, Dec 12, 2005
    #1
    1. Advertising

  2. deepak

    Sundar.k Guest

    Write a function on textbox keypress event and start comparing the text in
    text box

    with the dropdown
    something like

    var option =document.getelementbyId("dropdown1")getelementsbytagname("option")
    for (var i=o;i<option .length;i++)
    {
    var value=do a substring of this value equal to textboxtextlength(
    option(i).value)
    if(textbox1.text==value)
    {
    option(i).selected="selected";
    }

    }
    "deepak" wrote:

    > i have dropdownlist(ddlist) and textbox(tbox) , i want that if a user types
    > sometihing in the
    > textbox(tbox), the values present in the ddlist should appear e.g.
    > my ddlist has 3 values (india,indonesia,germany), if user types in text box
    > like "i" then dropdown
    > control should go to "india" and 'indonesia" (not to germany) and if he
    > types "n" the then it be on india,indonesia
    > and if he types "d" after "in" in text box then control should be on "india"
    > ,indonesia" and if he types 4th letter
    > say "i" then control shoudl select 2nd value which is "india",in this way
    > the procseesing should be done..there must be no postback, i know it can be
    > done with the help of javsscript but how..plz help me ,Thnaks in adavce to
    > everyone who will try to do this
    >
    >
     
    Sundar.k, Dec 12, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Reddy
    Replies:
    1
    Views:
    519
    Peter Blum
    Jan 23, 2004
  2. =?Utf-8?B?TmV3VG9Eb3ROZXQ=?=

    TextBox and DropDownList in Datagrid Edit mode

    =?Utf-8?B?TmV3VG9Eb3ROZXQ=?=, Jan 30, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    797
    =?Utf-8?B?TmV3VG9Eb3ROZXQ=?=
    Feb 9, 2004
  3. tanmaypatankar
    Replies:
    0
    Views:
    1,084
    tanmaypatankar
    Dec 18, 2007
  4. Zeebra3
    Replies:
    3
    Views:
    174
    Ken Cox [Microsoft MVP]
    Aug 8, 2003
  5. deepak kumar

    simple question(ddlist and javascript)

    deepak kumar, Oct 30, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    107
    deepak kumar
    Oct 30, 2004
Loading...

Share This Page