|
-
Aug 29th, 2006, 04:32 AM
#1
Thread Starter
Member
help needed in autocomplete textbox
hi,
i am using c# asp.net
i have one column in my database,columnname is empname.
i have textbox in my form and if i type 'a' in textbox the the names starts with 'a' has to come in that textbox.
actually in query if i use like condition i can get those names.but my need is i want to show those names in textbox itself,i dont want to use any other tools like listbox or combobox to view names starts with those 'a'.i need the letter starts with 'a' has to be displayed in my textbox itself,so that i can select from txtbox.please give me sugestion and olease give me coding to do that,pleaseeeeeee
-
Aug 29th, 2006, 10:48 AM
#2
Re: help needed in autocomplete textbox
You mean if the user types 'a', and there are 90 names that start with a, all 90 of those strings should appear as one single line inside the textbox? 
I won't give coding to do that, that defeats the purpose of this forum. I'll tell you what to look for.
You need AJAX for this, it's the best candidate for such a task. In the textbox's key press event in javascript, call a javascript function, passing it the value in the textbox) which calls a web service or an ASP.NET page. The sole purpose of this page is to accept a querystring parameter and return the list of names.
GetNames.aspx?startswith=mend
In the code for GetNames.aspx, look at Request.Querystring["startswith"], query the database, and return one big string containing all the names you want. In the AJAX's callback function, populate the textbox you want with all the names available.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|