I built a ASP.NET Webapplication and I have a TextBox where a User can find a other User. For this I want use the AutoCompleteExtender from AjaxToolKit. The Data I get from the Active Directory. If I start my Page the Application create a DataTable with all UserDate from ActiveDirectory and my Question is.
Can I use a DataTabe for the Informations in a AutoCompleteExtender? If I can use this how I can use this ?
According to the official documentation you can’t. Not only you can’t use a DataTable but you must implement a web service and within it, a webmethod with a very specific signature.
If you don’t mind using jQuery, I can show you an example using jQuery.
Update:
Using jQuery all you need to do is include the following libraries in your markup:
On your markup, you can add an
asp:hiddenElementand the text element that will be used for autocompletion as so:Now, you just add the following Javascript function:
Finally, you need to set the elements that you are going to use for autocompletion from codebhind. Since you want to use a DataTable, I’ll show you an easy way:
Read more examples from jQuery UI’s official documentation here.