Harper,
Your post is over a year old, so you may have moved on. I had similar symptoms and found that the response returned from the ToClientTemplate method was adding an extra "\n" in the <script> tag for the child grid when it had an editable ForeignKey column. I think it may have something to do with how Telerik encodes the script definition along with the validation for the resulting dropdown list. I was able to work around this by appending:
.ToHtmlString().Replace(
"u003e\\n\\u003c"
,
"u003e\\u003c"
)
to your Kendo Grid definition. You will then need to wrap the entire call with @Html.Raw()
The final result should looks something like this:
@Html.Raw(Html.Kendo().Grid<CheckinViewModel>()
.Name(
"grid_#=SubmissionLineItemId#"
)
.Columns(cols =>
{
cols.Command(cmd => cmd.Destroy()).Width(100);
cols.Bound(ci => ci.Id).Hidden();
cols.ForeignKey(ci => ci.StorageAreaId, (IEnumerable)ViewData[
"storageAreas"
],
"Id"
,
"Name"
).Title(
"Storage Area"
);
cols.Bound(ci => ci.Quantity);
cols.Bound(ci => ci.Bags);
cols.Bound(ci => ci.Buckets);
cols.Bound(ci => ci.Jars);
})
.ToolBar(tb =>
{
tb.Create().Text(
"Add Checkin"
);
tb.Save();
})
.Editable(ed => ed.Mode(GridEditMode.InCell))
.DataSource(ds => ds.Ajax()
.Read(read => read.Action(
"Get"
,
"Checkins"
,
new
{ submissionItemId =
"#=SubmissionLineItemId#"
}))
.Update(update => update.Action(
"Update"
,
"Checkins"
))
.Create(create => create.Action(
"Create"
,
"Checkins"
,
new
{ submissionId = @Model.Id, submissionItemId =
"#=SubmissionLineItemId#"
}))
.Destroy(destroy => destroy.Action(
"Delete"
,
"Checkins"
))
.Batch(
true
)
.Model(m =>
{
m.Id(ci => ci.Id);
m.Field(ci => ci.StorageArea).Editable(
false
);
})
.Events(ev => ev.RequestEnd(
"updateSubmissionGrid"
))
)
.ToClientTemplate().ToHtmlString().Replace(
"u003e\\n\\u003c"
,
"u003e\\u003c"
))