Showing posts with label ascx. Show all posts
Showing posts with label ascx. Show all posts

Wednesday, March 28, 2012

PageMethod called within User Control (ascx)

Hi all,

I am trying to call a PageMethod on an AutoComplete extender within an ascx (user control). I am able to do so when the extender sits directly on an ASPX (web form) but would like to reuse the component.

I know to decorate the method with [WebMethod] and [ScriptMethod] attributes and also to make the method static. I know, too, that the parameter names must match the expected signature.

Is it possible to place Page Methods within User Controls or do they have to sit on ASPX pages?

Thanks in advance,

MIKE

I have seen a couple of blog posts saying no and I was trying to do something similar last night and couldn't make it work. I would really perfer the AutoComplete extender and the NumericUpDown extender to have the option to fire events or at least non static methods but I don't think that will be possible under the current Ajax setup.

PageMethods call from user controls (ascx)

Hello,

i am looking for a way to call webmethods defined in an (ascx) user control (not a web form page aspx) using PageMethods.{MethodName}. For now, i only get a javascript error saying that PageMethods is not defined. Is there a different syntax to acces thos methods or is it just not possible ?

Thank you for your help

thomas

Any answer would be appreciated.

Thank you

thomas


hello.

currently, you can only call web service methods or page methods (and in this case, the methods must be static)