Hello,
I have the following client template:
When the code breaks on the 'Invalid Template Error", Here is what is in the output from the Dynamic Code page in VS2012:
If I make the template grid 'non editable', it works fine. Also, if I take the client grid and use it stand-alone, it works fine. It is only when I try to use it as a sub-grid in the hierarchical grid that it fails.
Thanks you!
Danny Green
I have the following client template:
<script id=
"questionsTemplate"
type=
"text/kendo-tmpl"
>
@(Html.Kendo().Grid<AssignedQuestionViewModel>()
.Name(
"Questions_#=QuestionGroupTemplateId#"
)
.Columns(columns =>
{
columns.Bound(i => i.QuestionTemplateId).Hidden();
columns.Bound(i => i.QuestionGroupTemplateId).Hidden();
columns.Bound(i => i.Required);
columns.Bound(i => i.QuestionText);
}
)
.ToolBar(toolBar => toolBar.Save())
.Editable(editable => editable.Mode(GridEditMode.InCell))
.DataSource(dataSource => dataSource
.Ajax()
.Batch(
true
)
.ServerOperation(
true
)
.Model(model =>
{
model.Id(m => m.QuestionTemplateId);
model.Field(m => m.QuestionTemplateId).Editable(
false
);
model.Field(m => m.QuestionGroupTemplateId).Editable(
false
);
})
.Read(read => read.Action(
"ReadAssignedQuestions"
,
"QuestionManagement"
,
new
{ p =
"#=QuestionGroupTemplateId"
})
.Type(HttpVerbs.Post)
)
.Update(update => update.Action(
"SaveAssignedQuestions"
,
"QuestionManagement"
))
)
.ToClientTemplate()
)
</script>
When the code breaks on the 'Invalid Template Error", Here is what is in the output from the Dynamic Code page in VS2012:
<
script
id
=
"questionsTemplate"
type
=
"text/kendo-tmpl"
>
<
div
class
=
"k-widget k-grid"
id
=
"Questions_#=QuestionGroupTemplateId#"
><
div
class
=
"k-toolbar k-grid-toolbar k-grid-top"
><
a
class
=
"k-button k-button-icontext k-grid-save-changes"
href
=
"#"
><
span
class
=
"k-icon k-update"
></
span
>Save changes</
a
><
a
class
=
"k-button k-button-icontext k-grid-cancel-changes"
href
=
"#"
><
span
class
=
"k-icon k-cancel"
></
span
>Cancel changes</
a
></
div
><
table
cellspacing
=
"0"
><
colgroup
><
col
/><
col
/></
colgroup
><
thead
class
=
"k-grid-header"
><
tr
><
th
class
=
"k-header"
data-field
=
"QuestionTemplateId"
data-title
=
"[en-US: QuestionTemplateId]"
scope
=
"col"
style
=
"display:none"
><
span
class
=
"k-link"
>[en-US: QuestionTemplateId]</
span
></
th
><
th
class
=
"k-header"
data-field
=
"QuestionGroupTemplateId"
data-title
=
"[en-US: QuestionGroupTemplateId]"
scope
=
"col"
style
=
"display:none"
><
span
class
=
"k-link"
>[en-US: QuestionGroupTemplateId]</
span
></
th
><
th
class
=
"k-header"
data-field
=
"Required"
data-title
=
"Required"
scope
=
"col"
><
span
class
=
"k-link"
>Required</
span
></
th
><
th
class
=
"k-header"
data-field
=
"QuestionText"
data-title
=
"Question Text"
scope
=
"col"
><
span
class
=
"k-link"
>Question Text</
span
></
th
></
tr
></
thead
><
tbody
><
tr
class
=
"t-no-data"
><
td
colspan
=
"2"
></
td
></
tr
></
tbody
></
table
></
div
><
script
>
jQuery(function(){jQuery("\#Questions_#=QuestionGroupTemplateId#").kendoGrid({"columns":[{"title":"[en-US: QuestionTemplateId]","hidden":true,"field":"QuestionTemplateId","encoded":true},{"title":"[en-US: QuestionGroupTemplateId]","hidden":true,"field":"QuestionGroupTemplateId","encoded":true},{"title":"Required","field":"Required","encoded":true,"editor":"\u003cdiv class=\"baseEditorTemplate\" style=\"\"\u003e\u003cdiv\u003e \u003c/div\u003e \u003cdiv\u003e \u003clabel for=\"Required\" title=\"Required\"\u003eRequired\u003c/label\u003e\u0026nbsp;\u003cinput class=\"checkBoxes\" data-val=\"true\" data-val-required=\"The Required field is required!!.\" id=\"Required\" name=\"Required\" title=\"Required\" type=\"checkbox\" value=\"true\" /\u003e\u003cinput name=\"Required\" type=\"hidden\" value=\"false\" /\u003e \u003c/div\u003e \u003cdiv id=\"errorMsg\"\u003e\u003cspan class=\"field-validation-valid\" data-valmsg-for=\"Required\" data-valmsg-replace=\"true\"\u003e\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cspan class=\"field-validation-valid\" data-valmsg-for=\"Required\" data-valmsg-replace=\"true\"\u003e\u003c/span\u003e"},{"title":"Question Text","field":"QuestionText","encoded":true,"editor":"\u003cdiv class=\"baseEditorTemplate\"\u003e\u003cdiv\u003e \u003clabel for=\"QuestionText\" title=\"Question Text\"\u003eQuestion Text\u003c/label\u003e\u003c/div\u003e\u003cdiv\u003e\u003cinput class=\"k-textbox\" data-val=\"true\" data-val-required=\"The Question Text field is required!!.\" id=\"QuestionText\" name=\"QuestionText\" title=\"Question Text\" type=\"text\" value=\"\" /\u003e \u003cdiv id=\"errorMsg\"\u003e\u003cspan class=\"field-validation-valid\" data-valmsg-for=\"QuestionText\" data-valmsg-replace=\"true\"\u003e\u003c/span\u003e\u003c/div\u003e \u003c/div\u003e\u003c/div\u003e\u003cspan class=\"field-validation-valid\" data-valmsg-for=\"QuestionText\" data-valmsg-replace=\"true\"\u003e\u003c/span\u003e"}],"scrollable":false,"editable":{"confirmation":"Are you sure you want to delete this item?","mode":"incell","template":null,"create":true,"update":true,"destroy":true},"toolbar":{"command":[{"name":null,"buttonType":"ImageAndText"}]},"dataSource":{"transport":{"read":{"url":"/Administration/QuestionManagement/ReadAssignedQuestions/#=QuestionGroupTemplateId","type":"POST"},"update":{"url":"/Administration/QuestionManagement/SaveAssignedQuestions"}},"serverPaging":true,"serverSorting":true,"serverFiltering":true,"serverGrouping":true,"serverAggregates":true,"type":"aspnetmvc-ajax","filter":[],"schema":{"data":"Data","total":"Total","errors":"Errors","model":{"id":"QuestionTemplateId","fields":{"QuestionTemplateId":{"editable":false,"type":"number"},"QuestionGroupTemplateId":{"editable":false,"type":"number"},"QuestionText":{"type":"string"},"Required":{"type":"boolean"}}}},"batch":true}});});
<\/script>
</
script
>
Thanks you!
Danny Green