Use a [WebMethod] in a TemplateControl

L

Larry Neylon

Hi all,

I want to be able to expose a [WebMethod] to a page when I add a Server
Control to a page, but I've no idea how (or if) you can do this.

In effect I want to be able to have:

public class MyWebControl : TemplateControl

{

[WebMethod]

public static string DoSomething()

{

.... process ajax call stuff


}

}

Then when I add the control to a page I want have DoSomething() available to
call via AJAX on the page. I've got this all working if I add the WebMethod
directly to the page, I just need to move DoSomething into the Server
Control rather than implement it in each page.

Any ideas?

Many Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top