views:

3201

answers:

4

Using ASP.NET 3.5 with VB codebehind.

I don't want to use a webservice to populate an autocomplete extender on a textbox. In this case, it's where the user is entering email addresses and I don't want to make a trip to the database every single time. I'd much rather keep a collection in session state and 'bind' the autocomplete to that.

Is it possible to set ServicePath and/or ServiceMethod to something in the codebehind as opposed to a webservice?

A: 

That specific autocomplete requires a webservice. You might want to consider using something like jQuery to do the autocomplete. I found this one on Google which supports a local array.

Ryan Brunner
Well, just to get the thing running, I did the webservice but it's not firing. I may have security issues to deal with (on a military base here)
David
A: 

You don't have to use a webservice per se. (.asmx or .svc)

But you would need a server script of some sort, .aspx, .ashx etc

You would need a database of some sort. You could keep something in the Application or Session if need be. If it's the same data put it in the Application.

The server script (whatever it may be) would have to filter the results based on what they're typing.

It's a ton easier to use a webservice though, especially with the built in JSON serializers.

after re-reading your question ...

You're really asking about Caching.

You can add the data of whatever query you are running and add it to the asp.net Cache.

WebServices have access to the same Cache object that .aspx's do.

So cache it and shove it out an asmx as JSON

Chad Grant
It's looking increasingly likely that I'll be forced to go the webservice route. Thanks.
David
A: 

How we create Service Path in Auto Complete Extender in Ajax

kajal
A: 

Yes, ServiceMethod can name a page method. See the documentation for AutoCompleteExtender. ServicePath as optional, and if ommitted, ServiceMethod is taken to reference a static method of the current ASP.NET page (which must be decorated with 2 specific attributes).

naasking