Hello,
I have some trouble to get the data bind of a list in a EditorTemplate for the schelduler.
Here is how i create the schelduler :
Code of _EditorTemplatePartial.cs
Here is the data load in the MultiSelect
........
The data in the multislect seems to be correctly loaded but when i want to save the data inside of TasksCreate() i have some trouble with my list.
Sample : If i select 4 item, my list count 4 row but haven't any data inside.
Moreover i can't try to use a datasource because of this template ".Editable(editable => { editable.TemplateName("_EditorTemplatePartial");"
My CalendarAttendeeModel is a List inside of the model TaskViewModel
I can't get the selected data in the list inside of the editor template.
In the TasksCreate i can get the data of Description,... (it's the user who write the data) but for the List, i have a big problem.
I use Kendo UI 2013.3.1511 and Razor engine.
I'm stuck with that :/
Any idea to suceed ?
I have some trouble to get the data bind of a list in a EditorTemplate for the schelduler.
Here is how i create the schelduler :
@(Html.Kendo().Scheduler<
iMail.Web.Models.TaskViewModel
>()
.Name("scheduler")
.Date(DateTime.Now)
.StartTime(new DateTime(2013, 6, 13, 7, 00, 00))
.Height(600)
.Views(views =>
{
views.DayView();
views.WeekView();
views.MonthView();
views.AgendaView(agenda => agenda.Selected(true));
})
.Selectable(true)
.Timezone("Etc/UTC")
.Events(e => e.Edit("onEdit"))
.Editable(editable => {
editable.TemplateName("_EditorTemplatePartial");
editable.Resize(true);
})
.DataSource(d => d
.Model(m => {
m.Id(f => f.TaskID);
m.Field(f => f.Title).DefaultValue("No title");
m.RecurrenceId(f => f.RecurrenceID);
m.Field(e => e.Attendees).DefaultValue(new List<
iMail.Web.Models.CalendarAttendeeModel
>());
})
.Events(e => e.Error("error_handler"))
.Read("TasksRead", "Dashboard")
.Create("TasksCreate", "Dashboard")
.Destroy("TasksDestroy", "Dashboard")
.Update("TasksUpdate", "Dashboard")
)
)
Code of _EditorTemplatePartial.cs
<
div
data-container-for
=
"Attendees"
class
=
"k-edit-field"
>
@(Html.Kendo().MultiSelectFor(model => model.Attendees)
.Name("myMultiSelectiHATEYOU")
.HtmlAttributes(new { data_bind = "value:Attendees" })
.DataTextField("AttendeeName")
.DataValueField("ID")
.BindTo(ViewBag.Contacts)
.Value(Model.Attendees)
</
div>
Here is the data load in the MultiSelect
ICollection<
CalendarAttendeeModel
> contacts = new List<
CalendarAttendeeModel
>();
CalendarAttendeeModel att7 = new CalendarAttendeeModel();
att7.AttendeeName = "Georgette";
att7.ID = 4;
att7.Email = "myemail@attendee7.com";
........
contacts.Add(att7);
contacts.Add(att8);
contacts.Add(att9);
contacts.Add(att10);
ViewBag.Contacts = contacts;
The data in the multislect seems to be correctly loaded but when i want to save the data inside of TasksCreate() i have some trouble with my list.
Sample : If i select 4 item, my list count 4 row but haven't any data inside.
Moreover i can't try to use a datasource because of this template ".Editable(editable => { editable.TemplateName("_EditorTemplatePartial");"
public ActionResult TasksCreate([Kendo.Mvc.UI.DataSourceRequest]Kendo.Mvc.UI.DataSourceRequest request, TaskViewModel task)
{
}
My CalendarAttendeeModel is a List inside of the model TaskViewModel
public class TaskViewModel : Kendo.Mvc.UI.ISchedulerEvent
{
....
public string Title { get; set; }
public string Description { get; set; }
public string StartTimezone { get; set; }
public string EndTimezone { get; set; }
....
public List<
CalendarAttendeeModel
> Attendees { get; set; }
}
I can't get the selected data in the list inside of the editor template.
In the TasksCreate i can get the data of Description,... (it's the user who write the data) but for the List, i have a big problem.
I use Kendo UI 2013.3.1511 and Razor engine.
I'm stuck with that :/
Any idea to suceed ?