I am using the following in my dataSource:
transport: {
read: {
contentType: "application/json; charset=utf-8",
url: "DepartmentHome.aspx/GetMembers",
dataType: "json"
},
create: {
url: "DepartmentHome.aspx/CreateMember",
type: "POST"
},
update: {
url: "DepartmentHome.aspx/EditMember",
type: "POST"
},
destroy: {
url: "DepartmentHome.aspx/DeleteMember",
type: "POST"
}
},
and in my code behind I have defined the WebMethods as such:
[WebMethod]
public static void CreateMember()
{
File.WriteAllText(@"C:\testing.txt", "This is a create.");
}
[WebMethod]
public static void EditMember()
{
File.WriteAllText(@"C:\testing.txt", "This is an update.");
}
[WebMethod]
public static void DeleteMember()
{
File.WriteAllText(@"C:\testing.txt", "This is a delete.");
}
When I create, edit, or delete a record it looks as if it has done it in the grid but it never calls the associated WebMethod.
I do see in firebug that it sends:
POST CreateMember
POST EditMember
POST DeleteMember
When I click on the associated buttons the POST data contains the parameters for that row:
FirstName: John
Id: 1
LastName: Smith
The Response back from the POST is just all the html from the page DepartmentHome.aspx.
I am using a WebMethod for read and that is working perfectly. I don't know what the difference would be?
I have attached the complete source code.
Any help would be greatly appreciated.
transport: {
read: {
contentType: "application/json; charset=utf-8",
url: "DepartmentHome.aspx/GetMembers",
dataType: "json"
},
create: {
url: "DepartmentHome.aspx/CreateMember",
type: "POST"
},
update: {
url: "DepartmentHome.aspx/EditMember",
type: "POST"
},
destroy: {
url: "DepartmentHome.aspx/DeleteMember",
type: "POST"
}
},
and in my code behind I have defined the WebMethods as such:
[WebMethod]
public static void CreateMember()
{
File.WriteAllText(@"C:\testing.txt", "This is a create.");
}
[WebMethod]
public static void EditMember()
{
File.WriteAllText(@"C:\testing.txt", "This is an update.");
}
[WebMethod]
public static void DeleteMember()
{
File.WriteAllText(@"C:\testing.txt", "This is a delete.");
}
When I create, edit, or delete a record it looks as if it has done it in the grid but it never calls the associated WebMethod.
I do see in firebug that it sends:
POST CreateMember
POST EditMember
POST DeleteMember
When I click on the associated buttons the POST data contains the parameters for that row:
FirstName: John
Id: 1
LastName: Smith
The Response back from the POST is just all the html from the page DepartmentHome.aspx.
I am using a WebMethod for read and that is working perfectly. I don't know what the difference would be?
I have attached the complete source code.
Any help would be greatly appreciated.