PageMethod - What is needed to use them?

D

dnadeveloper

Can anyone tell me what is is required to get the PageMethod code into my
..aspx pages? (More accurately, into the rendered page.)
So far I have a scripmanager with EnablePageMethods wet to true.


TIA
Chris
 
G

Guest

Chris,

I think they must be static and mark with WebMethod attribute

[System.Web.Services.WebMethod()]
public static string GetUserName(int id)
{
return "Chris";
}

Hope this helps
 
G

Guest

I forgot there's another attribute you need to apply,

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string GetUserName(int id)
{
return "Chris";
}

Now it should work
--
Milosz


Milosz Skalecki said:
Chris,

I think they must be static and mark with WebMethod attribute

[System.Web.Services.WebMethod()]
public static string GetUserName(int id)
{
return "Chris";
}

Hope this helps
--
Milosz


dnadeveloper said:
Can anyone tell me what is is required to get the PageMethod code into my
..aspx pages? (More accurately, into the rendered page.)
So far I have a scripmanager with EnablePageMethods wet to true.


TIA
Chris
 
D

dnadeveloper

Milosz Skalecki said:
I forgot there's another attribute you need to apply,

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string GetUserName(int id)
{
return "Chris";
}

Now it should work
--
Milosz


Milosz Skalecki said:

Thank you. All is good!



I think they must be static and mark with WebMethod attribute

[System.Web.Services.WebMethod()]
public static string GetUserName(int id)
{
return "Chris";
}

Hope this helps
--
Milosz


dnadeveloper said:
Can anyone tell me what is is required to get the PageMethod code into
my
..aspx pages? (More accurately, into the rendered page.)
So far I have a scripmanager with EnablePageMethods wet to true.


TIA
Chris
 

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,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top