In an asp.net 3.5 website, I have a jquery located in an ASPX page that should execute a function in code-behind. I have used a webmethod approach.
Here is the error: System.ArgumentException: Unknown web method CloneItem. Parameter name: methodName
Here is the relevant code:
ASPX page with relevant part of Jquery:
<%@ Page Language="VB" MasterPageFile="~/Pages/MasterPage.master" Title="Planning" %>
<%@ Register TagPrefix="PWC" Namespace="PWC" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<PWC:Planning runat="server" SkinFileName="Core/Planning.ascx" ID="Planning" Secured="true"/>
$("#dialog-form").dialog({
autoOpen: false,
height: 300,
width: 350,
modal: true,
buttons: {
"Create clone": function () {
var cloneItem = $('input[name=item]').is(":checked");
var intID = $(this).data('intID');
var bValid = true;
bValid = bValid && checkSelections();
if (bValid) {
$.ajax(
{
type: 'POST',
url: 'Planning.aspx/CloneItem',
data: "{'(intID': '" + $(this).data('intID') + "', 'item': '" + cloneItem + "'}" ,
dataType: 'json',
contentType: 'application/json; charset=utf-8'
// success: cloneOnSuccess,
// error: cloneOnError
});
$(this).dialog("close");
Function in Planning.aspx vb code-behind:
Imports System.Web
Imports System.Web.Services
<WebMethod(EnableSession:=True)> _
Public Shared Function CloneItem(intID As String, item As Boolean) As String
'execute a stored procedure here
Return "success!"
End Function
Master page has the following scriptmanager:
<AJAXToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeOut="600" EnablePartialRendering="true" CombineScripts="false" ScriptMode="Release" EnablePageMethods="true" >
</AJAXToolkit:ToolkitScriptManager>
Any idea on what I am doing wrong?