Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hai , i am having two textbox's . i want want to do auto search / auto fill for both text box and also i want to retrieve the data for second text box from Database based on first text box.
Posted
Comments
Suvendu Shekhar Giri 31-Mar-15 1:37am    
What have you tried so far?
Member 11490099 31-Mar-15 3:31am    
have tried this method. actually i want to auto fill the text box based on first text box value from database ,
eg : having two tables 1. company , 2. Person :
two text box txtComp and txtPers , here am auto filling txtComp , by selecting company name wanted to auto fill Person name in txtPers.

1 solution

Since you're talking about jQuery I would like to say, you should use autocomplete plugin by jQuery[^]. It allows you to provide it with a list of objects, that you can use as autocomplete values.

If you want it for both, you would add this to both of them. You can also download the list for the second text box from the database; using ajax requests, based on the text in the first text box.

Sample to allow autocomplete is,

<input id="autocomplete" type="text" />


// You can get the list from database too...
var list = ["One", "Two", "Three"];

// Set up the autocomplete.
$('#autocomplete').autocomplete({
   // add the list as source
   source: list
});


This way, you can set up autocomplete feature for your text boxes (please note that in ASP.NET a text box control is rendered as an input field in the browser for JavaScript; or jQuery, to manipulate it). You can read the link I have attached for more about autocomplete plugin.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900