I can get this to work if I have the c# [WebMethod] code in the default aspx.cs file but I cannot get it to work for a separate c# file I get a "webmethods undefined".
I have the script manager set to EnablePageMehods = true
.
My separate class looks like this
public class TestClass
{
[WebMethod]
public static string Test()
{
string a = "Hello Worlds";
return a;
}
}
The JS looks like this
function testwebmethod() {
PageMethods.Test(onSucceed, onError);
}
function onSucceed(result) {
alert(result);
}
function onError(result) {
}
I have tried inhereting from System.Web.UI.Page
as it works in defualt cs file but this still had no avil.
Thanks in advance