Re: AJAX - AutoCompleteExtender ASP.Net 2.0 (Page Method vs. Web S



Of course, the method signature in the code-behind file must be:

[WebMethod]
[ScriptMethod]
public static string[] MyMethod(string prefixText, int count)

Best regards,
Henning Krause


"Henning Krause [MVP - Exchange]" <newsgroups_remove@xxxxxxxxxxxxxxxxx> wrote in message news:e1RmbeFTHHA.4028@xxxxxxxxxxxxxxxxxxxxxxx
Hello,

I've a working autocomplete extender using this schema:

In Codebehind:

[WebMethod]
[ScriptMethod]
public static string MyMethod(string contextKey)
{}

In aspx site:

<ajaxToolkit:AutoCompleteExtender runat="server" ID="tbAutoCompleteExtender" TargetControlID="tbTextBox"

ServiceMethod="MyMethod" MinimumPrefixLength="2" CompletionInterval="1000"
EnableCaching="true" CompletionSetCount="12" />

Note that code-behind method must be in the .aspx file, even if the autocomplete extender is in a usercontrol.

Do you have the latest version of the Ajax toolkit installed? It's from february... so only a few days old.

Best regards,
Henning Krause


"Trent" <Trent@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:F2F66216-BA07-4D81-B066-C98831BF1BB8@xxxxxxxxxxxxxxxx
I applied [ScriptMethod] immediately after [WebService] and that didn't fix
it. Any other thoughts? Thanks!

"Henning Krause [MVP - Exchange]" wrote:

Hello,

you'll have to specify the [ScriptMethod] attribute in addition to the
[WebService] attribute.

Best regards,
Henning Krause

"Trent" <Trent@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:707AF9A7-9364-4976-9BD2-75312B84C1D0@xxxxxxxxxxxxxxxx
>I have tied an AutoCompleteExtender to a textbox to indicate >suggestions to
> the user. Everything works fine if I utilize a webservice to fetch > the
> results. However, I want to put the web service code into a page > method.
> I
> have run the debugger only to find that the [WebMethod] is never > entered.
> Here are some of the things I have already tried with no success. It
> appears
> that this is a common problem.
>
> -Added the [WebMethod] attribute to the top of the code-behind method.
> -Added/removed "Static" as part of the public method definition.
> -Removed the "ServicePath" attribute from the AutoCompleteExtender > .aspx
> page.
>
> My textbox and extender control are embedded into a user > control(.ascx)
> that
> is placed within a ContentPanel inherited from a MasterPage. I'm not > sure
> if
> this could be part of the problem. As I view the browser source code, > the
> javascript renders the "ServicePath" to be looking by default at my > aspx
> page, but my [WebMethod] lives in pagename.ascx.cs. Also, I have > tried
> including "ServicePath=pagename.ascx.cs" and still no luck.
>
> At this point, I don't know what else to try. The main reason I'm > wanting
> to move to a page method is because I need access to controls which > aren't
> available to the web service. Also, I don't think my needs here
> constitute
> the need for a web service.
>
> Any help would be greatly appreciated!
>
> Thanks,
>
> Trent




.



Relevant Pages

  • Re: AJAX - AutoCompleteExtender ASP.Net 2.0 (Page Method vs. Web S
    ... Note that code-behind method must be in the .aspx file, even if the autocomplete extender is in a usercontrol. ... I want to put the web service code into a page> method. ... > have run the debugger only to find that the [WebMethod] is never> entered. ...
    (microsoft.public.dotnet.general)
  • Re: <WebMethod()> In Front Of Each public function ?
    ... Webmethod indicates that it is a callable method of a web service. ... It could be public to the assembly but not callable via a web service. ... > Best Regards, ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Member variables in Web Service class
    ... [WebMethod] ... public String SayGoodbye() ... I know I can use the Session object, but I was lead to believe that it isn't best to use the ... Global.asax was added per default to each new web app (web service or web site). ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: AJAX - AutoCompleteExtender ASP.Net 2.0 (Page Method vs. Web S
    ... [WebMethod] ... [ScriptMethod] ... In aspx site: ... I want to put the web service code into a page ...
    (microsoft.public.dotnet.general)
  • Re: Thread.CurrentPrincipal is emtpy!
    ... protected override string AuthenticateToken(UsernameToken token) ... principal object created ... Regards, ... When i try accessing the same in my WebMethod, ...
    (microsoft.public.dotnet.framework.webservices.enhancements)

Loading