Search code examples
user-controlsautocompleteajaxcontroltoolkitpagemethods

How to: user AutoCompleteExtender in a UserControl (ascx) and place the ServiceMethod on its code-behind


I created a AutoCompleteExtender on a TextBox that resides on a UserControl (Control.ascx file).

I don't want to create a separate class for the web method, i rather placing it in the code file (Control.ascx.cs) itself.

Is there a way?

I have successfully tried once ago placing the method on the same page but it was a page, and if ServicePath property is not set it's automatically refered to the page so it worked, now since it's a user control it doesn't even when I explicitly specify the path.


Solution

  • You can actually keep the web method in .aspx while other autocomplete extender related code can reside in .ascx. It works fine.