0

I hope u will help me to find the answer. here i have one TextBox and one DropDown list ok. In this, Example: If i enter "Anu" in textbox, it should load it in dropdown list according to the textbox text. So how do i do? I am Using vb.net

2
  • You could call the keypress-event of the textbox and check for the keycode of 'Enter'. When pressed then add the value to the combobox? Commented Jan 23, 2014 at 7:42
  • Yes... its like that only... if i enter text like "Enter" it should load all like "Enter", "entff" in dropdown list.. related E letter.. @svranken Commented Jan 23, 2014 at 7:50

2 Answers 2

1

You can try this

 <asp:TextBox ID="txtName" clientidmode="static" runat="server" onblur="AddItem();"></asp:TextBox>

    <asp:DropDownList ID="ddlName" clientidmode="static" runat="server"></asp:DropDownList>

<script type="text/javascript">

    function AddItem()

    {

        // Create an Option object        

        var opt = document.createElement("option");

      // Add an Option object to Drop Down/List Box

        document.getElementById("ddlName").options.add(opt);

        // Assign text and value to Option object

        opt.text = document.getElementById("txtName").value;

        opt.value = document.getElementById("txtName").value;

    }

</script>
Sign up to request clarification or add additional context in comments.

3 Comments

Edited Please check ow
@Shu it should now as it is working on my end. Please share your code.
No its not working.....for example, if i enter c letter in text box i does't list all word which start with the letter c in dropdown list.. even i dint write any code in code behind for that.. @Pawan
0

Drag and drop a Dropdownlist onto your page, with a button beside it. Then double click the button and say:

Dropdownlist.Items.Add(Textbox1.Text);

PS: You'd better give us what you think about to avoid asking directly, because this will be misunderstood as homework.

2 Comments

he needs the javascript solution.
Any solutions? Please check my above comments and give the solutions if u have.. @Pawan

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.