request获取到的不为当前传入的id
后台代码
public static string userID = System.Web.HttpContext.Current.Request.QueryString["UserID"].ToString();
//public static string userID = "B222EF78-D0E6-4EF5-991B-F96800E56030";
[System.Web.Services.WebMethod]
public static int addEvent(ImproperCalendarEvent improperEvent)
{
CalendarEvent cevent = new CalendarEvent()
{
userid = userID,
title = improperEvent.title,
description = improperEvent.description,
start =System.DateTime.ParseExact(improperEvent.start, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture),
end = System.DateTime.ParseExact(improperEvent.end, "dd-MM-yyyy hh:mm:ss tt", CultureInfo.InvariantCulture),
};
if (CheckAlphaNumeric(cevent.title) && CheckAlphaNumeric(cevent.description))
{
int key = EventDAO.addevent(cevent);
List<int> idList = (List<int>)System.Web.HttpContext.Current.Session["idList"];
if (idList != null)
{
idList.Add(key);
}
return key;
}
return -1;
}
private static bool CheckAlphaNumeric(string str)
{
if (string.IsNullOrEmpty(str))
return false;
else
return true;
}
js
$(document).ready(function () {
$('#updatedialog').dialog({
autoOpen: false,
width: 570,
buttons: {
"更新": function () {
var eventToUpdate = {
id: currentU