Click here to Skip to main content
15,912,756 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
can anyone help me,

i want to use textbox which will display the names according to the text i am entering using javascript

(ex:when we are entering names in textbox to search for friends it will show the related names according to the text you are entering)
Posted
Updated 22-May-13 0:17am
v3
Comments
RelicV 22-May-13 6:17am    
I guess you should be doing a little bit of research before asking here..
Samresh.ss 22-May-13 6:34am    
You can use an autocompleteextender from ajax control toolkit.
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AutoComplete/AutoComplete.aspx
sravantarun 23-May-13 4:53am    
can we do this without using Ajax and web services???
Mohibur Rashid 23-May-13 10:14am    
sure you can

You need to use an "autocomplete" text box. This article shows an example Simple Autocomplete text box in asp.net[^]
 
Share this answer
 
Comments
sravantarun 23-May-13 0:33am    
I really liked this, but the thing is i need to check the data from database where i can find users.
CHill60 23-May-13 4:43am    
You can query the database up front or in GetCompletionList() (think about performance though) - where the example has string[] moves = {... just replace with a string array populated from your database
sravantarun 23-May-13 4:56am    
Can we do this without using Ajax and Web services???
This[^] is a very good jquery example. It converts a dropdownlist into an autocomplete list. Also the selected items can be added or removed as tags. Just populate the dropdownlist on page load and you are done after adding this script.
 
Share this answer
 
 
Share this answer
 
v2
Comments
sravantarun 23-May-13 1:59am    
can we do it with out ajax and webservices
RelicV 23-May-13 2:02am    
Hey, the point of auto-complete is to not to have a postback. In such case, we need to have this ajax call. If without Ajax and webservices, then you need to get the data beforehand while loading the page and then have to manipulate the data using jquery/JS. So, yes. We can do it.
sravantarun 23-May-13 4:52am    
That's what exactly i want auto-complete without Ajax and webservices. can you show me the way to do this,if it is with an example that would be great
Sounds like AutoComplete functionality.

Follow the below articles.
1. AutoComplete Demonstration[^].
2. Creating a Simple Auto-Complete TextBox[^].
3. JQuery UI autocomplete textbox with database in asp.net[^]
 
Share this answer
 
Hi Member 10069788,

JSFiddle Example

New version[^]

I've created the above one for your reference.

This is a kind of solution that I can suggest you, as we don't have any other alternatives and we are not supposed to use Ajax and WebServices as per you requirements.

So, get the data to your page on page load using a Db call for the first time and keep it in a hidden value in JSON format. From there onwards, you can play with it by using the above example.

Limitations: Large amounts of data will increase your page load time.

Play with it as per your usage and requirements.

Thank you,
Vamsi
 
Share this answer
 
v3

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