Hi,
I am in the process of evaluating the scheduler component and i am having the following issues:
[]I am getting a “The required anti-forgery form field “__RequestVerificationToken” is not present.”[/][]The data is not displaying on the actual schedule ( this could be that i am missing something in the sample\documentation or my model is not correct or maybe something completely different[/]
I am using ASP.Net MVC 4.0 and I am implimenting this on top of orchard CMS 1.6.1, i am also using the custom LightBoxControl.
Here is my Code :
Model
[code] public partial class ScheduleDTO
{
public virtual long ScheduleId { get; set; }
public virtual int ScheduleTypeId { get; set; }
public virtual EntityLookup ScheduledFor { get; set; }
public virtual List Trainers { get; set; }
public virtual List Students { get; set; }
public virtual DateTime StartDate { get; set; }
public virtual DateTime EndDate { get; set; }
public virtual string ScheduleSubject { get; set; }
public virtual string Notes { get; set; }
public virtual List ScheduledItems { get; set; }
public virtual EntityLookup Location { get; set; }
public virtual int StatusId { get; set; }
public long Id { get { return ScheduleId; } }
public DateTime start_date { get { return StartDate; } }
public DateTime end_date { get { return EndDate; } }
public string text { get { return ScheduleSubject; } }
public string details { get { return Notes;} }
}[/code]
Controller
[code] public ActionResult Index()
{
var scheduler = new DHXScheduler(this);
scheduler.Codebase = Url.Content("~/Modules/Comair.OT.Admin/Scripts/dhtmlxScheduler");
scheduler.Skin = DHXScheduler.Skins.Terrace;
scheduler.Config.multi_day = true;//render multiday events
scheduler.LoadData = true;
scheduler.EnableDataprocessor = true;
//view, width, height
var box = scheduler.Lightbox.SetExternalLightbox("Scheduler/LightboxControl", 550, 450);
//css class to be applied to the form
box.ClassName = "custom_lightbox";
scheduler.InitialDate = DateTime.Now;
return View(scheduler);
}
public JsonResult Data()
{
// this get the data from the database as a List<ScheduleDTO> and return Json to Index view
return Json(Schedules.ReadScheduleDTOList(), JsonRequestBehavior.AllowGet);
}[/code]
Custom LightBoxControl
[code]@model Comair.OT.Models.DTO.ScheduleDTO
@{
// Layout = null;
Script.Require(“KendoUI”).AtHead();
}
@Html.AntiForgeryToken()
@Html.HiddenFor(m => m.ScheduleId)
@*@Html.HiddenFor(m=>m.user_id)*@
@Html.HiddenFor(m => m.ScheduledFor.Id)
<div>
Scheduled For
@(Html.Kendo().ComboBox()
.Name("ScheduledForList")
.Filter(FilterType.Contains)
.Placeholder("Select Scheduled For")
.DataTextField("Name")
.DataValueField("EntityId")
.Events(events => events.Change("scheduledFor"))
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetScheduleForList", "Scheduler");
});
})
)
</div>
<div>
Trainer
@(Html.Kendo().ComboBox()
.Name("TrainerList")
.HtmlAttributes(new { style = "width:200px" })
.Filter(FilterType.Contains)
.Placeholder("--Select Trainer--")
.DataTextField("DisplayName")
.DataValueField("ProfileId")
.Events(events => events.Change("addTrainer"))
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetTrainers", "Scheduler");
});
})
)
@Html.ListBoxFor(m => m.Trainers, new SelectList(new[] { "" }))
</div>
<div>
Students
@(Html.Kendo().ComboBox()
.Name("StudentList")
.Filter("contains")
.Placeholder("--Select Student--")
.DataTextField("DisplayName")
.DataValueField("ProfileId")
.Events(events => events.Change("addStudent"))
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetStudents", "Scheduler");
});
})
)
@Html.ListBoxFor(m => m.Students, new SelectList(new[] { "" }))
</div>
<div>
Location
@(Html.Kendo().ComboBox()
.Name("LocationList")
.Filter("contains")
.Placeholder("--Select Location--")
.DataTextField("DisplayName")
.DataValueField("ProfileId")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetLocations", "Scheduler");
});
})
)
</div>
<div>
Subject
@Html.TextBoxFor(m => m.ScheduleSubject, new { style = "width: 200px" })
</div>
<div>
Notes
@Html.TextAreaFor(m => m.Notes, 5, 52, null)
</div>
<div>
From
@Html.TextBoxFor(m => m.StartDate, new { @class = "scheduleDate", width = "150px" })
To
@Html.TextBoxFor(m => m.EndDate, new { @class = "scheduleDate", width = "150px" })
</div>
<p>
<input type="submit" name="actionButton" value="Save" />
<input type="button" onclick="lightbox.close()/* helper-method, only available in custom lightbox */" value="Close" />
<input type="submit" name="actionButton" value="Delete" />
</p>
}
[/code]
Index View
[code]@{
Style.Require(“SchedulerStyle”);
}
Schedule
ScheduleStyle.css
[code]html, body
{
margin:0;
padding:0;
height:100%;
overflow:auto;
}
body
{
background: #5c87b2;
background-image:url(./bg.png);
font-size: .75em;
font-family: “Segoe UI”, Verdana, Helvetice, Sans-Serif;
margin: 0;
padding: 0;
color: #393939;
}
.page
{
width:1020px;
margin:0 auto;
}
#calendar
{
height:600px;
margin-top:20px;
}
a:link, a:visited
{
color: #ffffff;
text-decoration: underline;
}
a:hover
{
text-decoration: none;
}
/header line/
.head_line
{
background-color:#2e3b49;
height: 15px;
padding: 8px 0;
}
.head_inner
{
margin:0 auto;
width: 1020px;
}
.head_inner, .head_inner
{
color: #efefef;
}
/* additional styles for login page*/
#logindisplay
{
font-size:1.1em;
display:block;
text-align:right;
margin:10px;
color:White;
}
#logindisplay a:link, #logindisplay a:visited
{
color: white;
text-decoration: underline;
}
#logindisplay a:hover
{
color: white;
text-decoration: none;
}
.editor-label
{
margin-top:10px;
line-height:120%;
height:20px;
cursor:pointer;
}
.editor-label input
{
border: 1px solid #e2e2e2;
}
.editor-label label
{
font-size:13px;
}
.editor-label input, .editor-label label{
vertical-align:middle;
}
#login
{
background-color:#d3dce0;
border:1px solid #787878;
cursor:pointer;
padding:4px;
margin-left:10px;
font-size:1.2em;
}
/override some of scheduler colors/
/week agenda and month event text color/
.dhx_wa_ev_body, .dhx_cal_event_clear
{
color:#efefef !important;
}
.dhx_cal_event .dhx_header,
.dhx_cal_event .dhx_footer,
.dhx_cal_event .dhx_body,
.dhx_cal_event .dhx_title
{
border-color:white !important;
}[/code]
Your help is greatly appreciated, i really like this control but have been battling with these and other issues for over a week now.
Thanks
Paul