[英]Allow the user to add only one event per cell over FullCalendar resource view
我正在使用FullCalendar,如果用户已在前一天添加了活动,是否可以禁止该用户在同一天输入另一个活动?
[System.Web.Services.WebMethod(true)]
public static void AllowEvents(DateTime start, DateTime end, int Resource_id)
{
//using the startdate enddate and resourceid to pick the events already in that cell
DataTable dt = new DataTable();
dt = EventDAO2.AllowEvents(start, end, user_id);
//get the eventid in dt.
if (dt.Rows.Count > 0)
{
//show a message"An event already exists in this cell"
}
//otherwise allow a popup window for entering event details,and add that values to the server.
}
一些错误,它无法正常工作。我不知道如何在C#代码后面显示警告消息。
您需要对返回的数据表执行Select
操作,以检查您的eventid
是否已经存在。
像这样:
DataTable dt = new DataTable();
dt = EventDAO2.AllowEvents(start, end, user_id);
//get the eventid in dt.
if (dt.Rows.Count > 0)
{
DataRow[] drs = dt.Select("eventid=2 And user_id=" + user_id); //example
if(drs.Length > 0)
{
//show a message"An event already exists in this cell"
}
else
{
//otherwise allow a popup window for entering event details,and add that values to the server.
}
}
else
{
//otherwise allow a popup window for entering event details,and add that values to the server.
}
您无法显示来自Web服务的警报消息。 但是,您可以根据从Web服务收到的响应执行操作。
您可以使用jquery跟踪网络方法响应, 这是有用的链接 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.