This doesn't seem to work with asp.net pagemethods?

This doesn't seem to work with asp.net pagemethods?

buaayttbuaaytt Posts: 12Questions: 0Answers: 0
edited October 2013 in General
Here's the code:
[code]
$(".dataTable").dataTable({
"bServerSide": true,
"bProcessing": true,
"sAjaxSource": "../../Default.aspx/Test",
"sServerMethod": "POST",
"fnServerParams": function (aoData) {
aoData.push({ "name": "data", "value": JSON.stringify(searchModel) });
}
});
[/code]

When I debug my Default.aspx in VS, which is quite simple:
[code]
protected void Page_Load(object sender, EventArgs e)
{
FunctionName = "Home";
}

[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static string Test()
{
return JsonConvert.SerializeObject(new { Name = "SomeValue" });
}
[/code]

The breakpoint in Page_Load method can be hit while one in Test method can't whatsoever. Anyone had successful experience retrieving data with PageMethods?

Thanks for any help!

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Link to a test case as noted in the forum rules please.

    Allan
  • buaayttbuaaytt Posts: 12Questions: 0Answers: 0
    well, this is no big deal. i don't know if there's any public site for testing asp.net pages. anyway, i just change to post to an aspx page, instead of the pagemethods. not elegant, but works.
This discussion has been closed.