这里是从jquery调用一个页面方法。 这里我的更新方法工作正常。但添加和删除提取此错误的方法。 这是我的代码。此代码在jquery完整日历示例中使用。 如果你知道任何人给出答案..
$('#updatedialog').dialog({
autoOpen: false,
width: 470,
buttons: {
"update": function () {
//alert(currentUpdateEvent.title);
var eventToUpdate = {
id: currentUpdateEvent.id,
title: $("#eventName").val(),
description: $("#eventDesc").val()
};
PageMethods.UpdateEvent(eventToUpdate, updateSuccess);
$(this).dialog("close");
currentUpdateEvent.title = $("#eventName").val();
currentUpdateEvent.description = $("#eventDesc").val();
$('#calendar').fullCalendar('updateEvent', currentUpdateEvent);
},
"delete": function () {
if (confirm("do you really want to delete this event?")) {
PageMethods.deleteEvent($("#eventId").val(), deleteSuccess);
$(this).dialog("close");
$('#calendar').fullCalendar('removeEvents', $("#eventId").val());
}
}
$('#addDialog').dialog({
autoOpen: false,
width: 670,
height: 600,
buttons: {
"Add": function () {
//alert("sent:" + addStartDate.format("dd-MM-yyyy hh:mm:ss tt") + "==" + addStartDate.toLocaleString());
var eventToAdd = {
title: $("#txtSubject").val(),
description: $("#addEventDesc").val(),
start: $("#txtStartdate").val(),
end: $("#txtStartdate").val()
};
var ChkBox = document.getElementById("rbtnHourly");
if (ChkBox.checked == true) {
var eventToAddrecurrence = {
FREQ: "Hourly",
INTERVAL: $("#updown").val(),
BYSETPOS: "",
BYDAY: "",
BYMONTH: "",
BYMONTHDAY: ""
};
}
var ChkBox1 = document.getElementById("rbtnDaily");
if (ChkBox1.checked == true) {
var rbtnEveryday = document.getElementById("rbtnEveryday");
if (rbtnEveryday.checked == true) {
var eventToAddrecurrence = {
FREQ: "Daily",
INTERVAL: $("#TextBox1").val(),
BYSETPOS: "",
BYDAY: "MO,TU,WE,TH,FR,SA,SU",
BYMONTH: "",
BYMONTHDAY: ""
};
}
else {
var eventToAddrecurrence = {
FREQ: "Daily",
INTERVAL: 1,
BYSETPOS: "",
BYDAY: "MO,TU,WE,TH,FR",
BYMONTH: "",
BYMONTHDAY: ""
};
};
}
var ChkBox4 = document.getElementById("rbtnEnddateno");
if (ChkBox4.checked == true) {
var eventToAddEnddate = {
COUNT: 0
};
}
var ChkBox2 = document.getElementById("rbtnEnddateafter");
if (ChkBox2.checked == true) {
var eventToAddEnddate = {
COUNT: $("#TextBox7").val()
};
}
var ChkBox3 = document.getElementById("rbtnEnddateafter");
if (ChkBox3.checked == true) {
var eventToAddEnddate = {
COUNT: $("#TextBox8").val()
};
}
//else {
//alert("sending " + eventToAdd.title);
PageMethods.addEvent(eventToAdd,addSuccess);
$(this).dialog("close");
// }
}
}