views:

8

answers:

1

Hi! I have web page which is using AjaxControlToolkit:AutoCompleteExtener on some TextBox. This extender requires service method, from which it will get data to display:

[System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()] public static string[] GetCompletionList2(string prefixText, int count, string contextKey) { return DatabaseSearch.GetUnits().GetSymbolCompletion(prefixText, organizationToSearch); }

In this method I use some argument = organizationToSearch. But I don't want this argument to be static ! And since the method is static I don't know what to do. If I remove the 'static' keyword from method definition it won't work... And I really don't want change organizationToSearch to static either!

Please help.

A: 

It must be static 'cause you're not in the execution of your page. When you're calling an AjaxMethod, your page (webforms) doesn't exists.

remi bourgarel
So, is there a way to use non-static variables inside of this method?
Richmond
You have to add it in your method's parameters
remi bourgarel