how do i make an autoplete textbox in asp? but i need to get the autoplete data by querying the database. I dont really know how to explain this, sory if theres not enough detail. i cant use ajax, because i think i will have pability issues with my old app. so im thinking of doing this using java script. or is there a way to do this by using ? im using C# for codebehind. thanks
how do i make an autoplete textbox in asp? but i need to get the autoplete data by querying the database. I dont really know how to explain this, sory if theres not enough detail. i cant use ajax, because i think i will have pability issues with my old app. so im thinking of doing this using java script. or is there a way to do this by using ? im using C# for codebehind. thanks
Share Improve this question edited Nov 17, 2008 at 4:44 George Stocker 57.9k29 gold badges181 silver badges238 bronze badges asked Nov 14, 2008 at 10:49 AdytAdyt 1,4727 gold badges26 silver badges39 bronze badges4 Answers
Reset to default 3It's going to be a lot of effort without using some third party autoplete I think - not sure what you mean by 'I can't use ajax', but how about using the ASP.NET AJAX autoplete control, setting the ServiceMethod
property to a static Page Method in your code behind? That keeps it contained within your page at least.
The Page Method can go off to your database, and return a String[] of results.
If you decide to use it, you'll need to set the EnablePageMethods
property to true
in the <asp:ScriptManager>
control.
AJAX is JavaScript. It's JavaScript using the XMLHttpRequest object to make the asynchronous request. Here's an article about it and ASP.NET.
If you want to know more about AJAX, (Asynchronous JavaScript and XML), I'd check out Wikipedia first. If you want books on it, there are a ton. I remend Programming ASP.NET AJAX by Christian Wenz (O'Reilly And Associates).
if you dont want to uses ajax library, try jquery
there are many plugin autoplete or suggest textbox for jquery try this one http://www.vulgarisoip./2007/08/06/jquerysuggest-11/
The ASP.NET AJAX framework works for ASP.NET 2.0 & above. As such it will not work in Visual Studio 2003 environment.
Anthem.NET is a free, cross-browser AJAX toolkit/framework for the ASP.NET development environment that works with both ASP.NET 1.1 and 2.0 - http://sourceforge/projects/anthem-dot-net
For your autoplete requirement, you can consider using the jQuery Autoplete Plugin
It requires very less programming. Check the demo & code sample here - http://docs.jquery./Plugins/Autoplete
It's autoplete() method takes a URL or array to populate your autopletion list. You can pass the URL of the page that fetches the results from the database directly.