As you can see, the detail grid uses a popup editor (custom editortemplate defined in /shared/EditorTemplates/CourseEntryVM.cshtml).
On that custom popup editor template, I need to have access to the master id (from CourseVM) in order to do some filtering for a dropdownlist, but I don't know how to have that Id.
@(Html.Kendo().Grid<CourseVM>()
.Name(
"CourseGrid"
)
.DataSource(ds => ds
.Ajax()
.Events(events => events.Error(
"courseGridError"
))
.Model(model => model.Id(o => o.Id))
.Read(read => read.Action(
"Course_Read"
,
"Course"
))
.Destroy(destroy => destroy.Action(
"Course_Destroy"
,
"Course"
))
.ServerOperation(
false
)
)
.Columns(columns =>
{
columns.Bound(c => c.Id).Hidden();
columns.Bound(c => c.Number);
columns.Bound(c => c.OrganisationDisplay);
columns.Bound(c => c.BeginDate);
columns.Bound(c => c.EndDate);
columns.Command(commands =>
{
commands.Custom(
"Aanpassen"
).Click(
"courseEdit"
);
commands.Destroy().Text(
"Verwijderen"
);
}).Title(
"Commands"
).Width(200);
})
.ToolBar(toolbar =>
{
toolbar.Custom().Text(
"Nieuwe cursus inrichten"
).Action(
"Create"
,
"Course"
);
})
.Pageable()
.Sortable()
.ClientDetailTemplateId(
"courseDetailTemplate"
)
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
)
<script id=
"courseDetailTemplate"
type=
"text/kendo-tmpl"
>
@(Html.Kendo().TabStrip()
.Name(
"tabStrip_#=Id#"
)
.SelectedIndex(0)
.Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
.Items(items =>
{
items.Add().Text(
"Inschrijvingen"
).Content(
@<text>
@(Html.Kendo().Grid<CourseEntryVM>()
.Name(
"entryGrid_#=Id#"
)
.Columns(columns =>
{
columns.Bound(c => c.StudentDisplay);
columns.Bound(c => c.EntryDate);
})
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(c => c.StudentPersonAccountId);
})
.PageSize(30)
.Read(read => read.Action(
"Entry_Read"
,
"Course"
,
new
{ courseId =
"#=Id#"
}))
.Create(create => create.Action(
"Entry_Create"
,
"Course"
,
new
{ courseId =
"#=Id#"
}))
.ServerOperation(
false
)
)
.ToolBar(toolbar =>
{
toolbar.Create().Text(
"Inschrijving toevoegen"
);
})
.Editable(editable => editable.Mode(GridEditMode.PopUp))
.Pageable()
.Sortable()
.Events(events => events.Save(
"entryGridSaving"
))
.ToClientTemplate())
</text>
);
})
.ToClientTemplate()
)
</script>