Hello.
I have a scheduler and an EditorTemplate.
I want to bind a multiselectfor after the reading method. (with my Model which is populated in the read Method).
I suppose the .BindTo() Display nothing because the read method 'll be call after this one.
So here is my scheduler :
And here is my MultiSelectFor in the _EditorTemplatePartial.cs file.
Model.Invited has a structure like this :
}
Here is a part of my model :
Each event in the Scheduler have an ID (TaskID)
The Model is populated in the TaskRead fct and works correctly.
But my multiselectFor is empty.
How can i use .bindTo() fct in the MultiSelectFor() after the Model is populated by "TaskRead" ?
I have a scheduler and an EditorTemplate.
I want to bind a multiselectfor after the reading method. (with my Model which is populated in the read Method).
I suppose the .BindTo() Display nothing because the read method 'll be call after this one.
So here is my scheduler :
@(Html.Kendo().Scheduler<
iMail.Web.Models.TaskViewModel
>()
.Name("scheduler")
.Date(DateTime.Now)
.Timezone("Etc/UTC")
.Views(views =>
{
views.DayView();
views.WeekView();
views.MonthView();
views.AgendaView(agenda => agenda.Selected(true));
})
.Selectable(true)
.Timezone("Etc/UTC")
.Events(e =>
{
e.Edit("onEdit");
e.Change("onChange");
})
.Editable(editable =>
{
editable.TemplateName("_EditorTemplatePartial");
})
.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(f => f.Priority);
m.Field(f => f.TypeID);
})
.Events(e => e.Error("error_handler"))
.Read (read => read.Action("TasksRead", "Calendar").Data("additionalInfo").Type(HttpVerbs.Get))
.Create(create => create.Action("TasksCreate", "Calendar").Data("additionalInfo"))
.Destroy(destroy => destroy.Action("TasksDestroy", "Calendar").Data("additionalInfo"))
.Update(update => update.Action("TasksUpdate", "Calendar").Data("additionalInfo"))
)
)
And here is my MultiSelectFor in the _EditorTemplatePartial.cs file.
<
div
id
=
"AttendeeAlreadyInvited"
>
<
div
data-container-for
=
"AlreadyInvitedID"
class
=
"k-edit-field"
>
@(Html.Kendo().MultiSelectFor(model => model.AlreadyInvitedID)
.HtmlAttributes(new { data_bind = "value:AlreadyInvitedID" })
.DataTextField("Name")
.DataValueField("ID")
.BindTo(Model.Invited)
)
</
div
>
</
div
>
Model.Invited has a structure like this :
public class CalEmployeeLight
{
public int ID;
public string Name;
}
Here is a part of my model :
public class TaskViewModel : Kendo.Mvc.UI.ISchedulerEvent
{
public int TaskID { get; set; } //each event have an ID.
.....
public IEnumerable<
int
> AlreadyInvitedID { get; set; }
public ICollection<
CalEmployeeLight
> Invited { get; set; }
}
Each event in the Scheduler have an ID (TaskID)
The Model is populated in the TaskRead fct and works correctly.
But my multiselectFor is empty.
How can i use .bindTo() fct in the MultiSelectFor() after the Model is populated by "TaskRead" ?