DropDownList(ddlist) and TextBox(tbox)

D

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
 
S

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";
}

}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top