Wednesday, April 6, 2011

HttpContext and AutoComplete Extender

I am using AutoComplete Extender from Ajax control tool kit. I have a webservice that this extender uses. In the web method I need to access a value "empid" which is present in my aspx page. I placed this value in HttpContext's Items collection in my aspx page.

HttpContext.Items["empid"]=;

In the web method I am trying to access the same using

string s=Context.Items["empid"];

But Items collection does not have any item there. Is this due to the partial postback the autocomplete extender control is doing.

Can some one help?

From stackoverflow
  • The AutoComplete Extender uses a web method with a specific signature (explained in the documentation) on a web service. This will be called from the browser using JavaScript (behind the scenes).

    The web service and its web method know nothing about your page - they only know the information that is passed to them in the arguments of the web method.

    Richard Ev : Calling Context.Cache["key"] will simply return null if no item called "key" exists, so I think that's what you're seeing.
    Richard Ev : I don't understand what you mean Deepa - however from a design point of view I would say that the web method should not rely on data in your cache, unless it put the data there itself.
    Richard Ev : What are you caching, and why? If you are caching for performance reasons, have you proven that you actually have a performance issue and that it is resolved by caching?
    Richard Ev : I think you need to store your cached data in your database in a rapid-to-query form, and access it from your web service call. I'm assuming that you have a database query that is your bottleneck...

0 comments:

Post a Comment