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 country name 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?
Regards
kumar
Unfortunately, there is no direct option to do that other than hacking into javascript to stop the browser from making a call to get the list.
The only other choice I can see is to create a webservice & use
EnableCachingproperty ofAutoCompleteExtender, to make sure the result of the webservice is cached on the client, thereby avoiding calls to webservice (and database in turn).EDIT: On a second thought, I think it could be possible to mark a public static method in your page with
WebMethodattribute & set theServicePathto your aspx page.see if this helps – http://blogs.msdn.com/sburke/archive/2006/10/21/hint-components-that-use-web-services-with-asp-net-ajax-v1-0-beta.aspx
I think it should work. But am not sure, if the framework requires it to be the webservice.