Home All Groups Group Topic Archive Search About

DropDownList(ddlist) and TextBox(tbox)

Author
12 Dec 2005 10:21 AM
deepak
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

Author
12 Dec 2005 5:58 PM
Sundar.k
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";
}

}
Show quoteHide quote
"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
>
>