PageMethod - What is needed to use them?

  • Thread starter Thread starter dnadeveloper
  • Start date Start date
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
 
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
 
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
 
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
 
Back
Top