Hello,
i am using custom template for Event add/edit with Kendo Scheduler. I am trying to presenect attendees when user clicks to create new Event. Here is my Scheduler edit event
function scheduler_edit(e) {
var usrName = "@HttpContext.Current.User.Identity.Name";
if ( e.event.CanOpen) {
e.preventDefault();
}
var eventid = e.event.id;
if (e.event.isNew()) {
var rootDir = "@Url.Content("~/")";
$.ajax({
url: rootDir + "Objekt/LoadAdress",
cache: false,
async: false,
data: {
strSelectedObjectID: objectid
},
success: function (data) {
if (data.result == "Error") {
alert(data.message);
} else {
var value = usrName.split(",");
e.event.set("ObjectDesc", desc);
e.event.set("ObjectID", objectid);
e.event.set("LetterHead", data.LetterHead);
e.event.set("Attendees", usrName);
}
}
});
}
}
}
}
The objectID and rest of fields Comes populated. Only Attendees is blank.
The customtemplate has the attendees multiselect as
<div data-container-for="Attendees" class="k-edit-field">
@(Html.Kendo().MultiSelectFor(model => model.Attendees)
.Name("attendies")
.HtmlAttributes(new { data_bind = "value:Attendees" ,style = "width: 300px"})
.DataTextField("LoginName")
.DataValueField("LoginName")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetCustomers", "Scheduler");
});
})
.Events(e => { e.DataBound("data_bound"); })
.Value((List<Object>)ViewBag.SelectedUser)
.ValuePrimitive(true)
.TagTemplate("<span class='k-scheduler-mark' style='background-color:\\#= data.Color?Color:'' \\#'></span>\\#=LoginName\\#")
.ItemTemplate("<span class='k-scheduler-mark' style='background-color:\\#= data.Color?Color:'' \\#'></span>\\#=LoginName\\#")
)
<span class="k-invalid-msg" data-for="Attendees"></span>
</div>
Thanks
Anamika