Is there a way by which i can achieve functionality of page method inside a user control.
Any help is appreciated, Thanks :)
Is there a way by which i can achieve functionality of page method inside a user control.
Any help is appreciated, Thanks :)
What works for me is to put my WebMethods in a custom class that is derived from System.Web.UI.Page
Then whenever I have a page containing a usercontrol that needs to consume that WebMethod, I derive that page from my custom page class instead of System.Web.UI.Page.
The easiest way is probably to put the functionality you want in a webservice then use the scriptservice attribute to make that available.
Works very similarly to a page method.
Quite an extensive example here.
Then you can call your webmethods in JS: MyNamespace.MyWs.MyMethod();