This is a migrated thread and some comments may be shown as answers.

Invalid Template

1 Answer 277 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jean-Paul
Top achievements
Rank 1
Jean-Paul asked on 19 Jul 2012, 01:37 PM
I am a newbie to Kendo UI and currently porting from the telerik mvc to Kendo UI for MVC . I have come across a problem when porting my grid from telerik mvc to kendo ui for mvc. I used the detail template approach for nested grids without a problem with telerik mvc , but when trying to port to client templates within kendo I am getting "Invalid Template" error.
 Am I missing something in my initial file includes.

<link rel="stylesheet" href="@Url.Content("~/Content/kendo.common.min.css")">
<link rel="stylesheet" href="@Url.Content("~/Content/kendo.silver.min.css")">
<script src="@Url.Content("~/Scripts/jquery.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo.all.js")"></script>
<script src="@Url.Content("~/Scripts/kendo.aspnetmvc.min.js")"></script>

Here is a snippet of code that uses a client template
@( Html.Kendo().Grid<DetailCategoryListingGridView>()
.Name("DetailCategoryGrid").
Columns(columns =>{
 columns.Bound(a => a.Value).Title(
"CategoryValue").Width(200);
columns.Bound(a => a.Comments).Title("Description");
columns.Bound(a => a.ModifiedDate).Title("LastUpdated").Format("{0:MM/dd/yyyy}").Width(150);
columns.Bound(a => a.ModifiedBy).Title("UpdatedBy").Width(150);
columns.Bound(a => a.DetailCategoryID).Title("UpdatedBy").Width(150);
columns.Command(commands =>
{
commands.Destroy();
commands.Edit();})
.HtmlAttributes(
new {style = "text-align:center"});
})

 

 .ClientDetailTemplateId("udfTemplate")
.Pageable().DataSource(dataBinding => dataBinding.Ajax()
.Read(read=>read.Action("FilteredDetailCategoryBinding", "DetailCategoryAdmin"))
.Create(create=>create.Action("InsertDetailCategory", "DetailCategoryAdmin"))
 .Update(update=>update.Action("UpdateDetailCategory", "DetailCategoryAdmin"))
.Destroy(destroy=>destroy.Action("DeleteDetailCategory", "DetailCategoryAdmin"))
 .Model(model => model.Id(a => a.DetailCategoryID)) .PageSize(15)

 )
 .Sortable()
 .Pageable(page=>page.PageSizes(true))
 //.Events(events => events.DataBound("dataBound")
  )

 

 

<script id="udfTemplate" type="text/kendo-tmpl">

 @(Html.Kendo().Grid<UDFInventoryTemplate>()
.Name("UDFInventoryDetails_#=DetailCategoryID#")
 .Columns(columns =>
{
columns.Bound(o => o.LabelValue);
columns.Bound(o => o.Status);
columns.Bound(o => o.ControlType);
 columns.Bound(o => o.ControlDataValues);
 columns.Bound(o => o.DefaultValue); })
.DataSource(dataSource => dataSource.Ajax() .Read(read=>read
.Action(
"FilteredUDFDetails", "DetailCategoryAdmin"))

).ToClientTemplate()
)
</script>


Thanks,
Jean-Paul

 

 

 

1 Answer, 1 is accepted

Sort by
0
Iliana Dyankova
Telerik team
answered on 24 Jul 2012, 10:52 AM
Hello Jean-Paul,

The code snippet looks OK, but I am afraid it is not enough to detect where the reason for the problem is. Could you please provide a sample runnable project that I can test locally? Thus way I would be able to investigate your case in details and do my best to provide you with an accurate solution. Thank you in advance for your cooperation.

Greetings,
Iliana Nikolova
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Jean-Paul
Top achievements
Rank 1
Answers by
Iliana Dyankova
Telerik team
Share this question
or