Another 'Invalid Template' error ... there are tons out there, and I thought I'd find my answer, but no.
The hierarchy (nested) grid below works great until I uncomment line 58 or 67. Then I get the invalid template error.
I've escaped my hash symbols on line 52 as I read in a ton of other posts.
Does anyone spot anything amiss???
TIA
001.
@(Html.Kendo().Grid<OrgViewModel>()
002.
.Name(
"Grid"
)
003.
.Columns(columns =>
004.
{
005.
columns.Bound(e => e.OrgType).Hidden(
true
);
006.
columns.Bound(e => e.OrgId).Hidden(
true
);
007.
columns.Bound(e => e.OrganizationType).Title(
"Partner or Charter"
);
008.
columns.Bound(e => e.OrgName).Title(
"Name"
);
009.
})
010.
.Filterable(filterable => filterable
011.
.Extra(
false
)
012.
.Operators(operators => operators
013.
.ForString(str => str.Clear()
014.
.StartsWith(
"Starts with"
)
015.
.IsEqualTo(
"Is equal to"
)
016.
.IsNotEqualTo(
"Is not equal to"
)
017.
))
018.
)
019.
.Groupable()
020.
.Pageable(m => m.PageSizes(
new
[] {
"20"
,
"50"
,
"100"
,
"All"
}))
021.
.Resizable(resizable => resizable.Columns(
true
))
022.
.Sortable()
023.
.Scrollable(s => s.Enabled(
true
))
024.
.ClientDetailTemplateId(
"template"
)
025.
.HtmlAttributes(
new
{ style =
"height:850px;"
})
026.
.DataSource(dataSource => dataSource
027.
.Ajax()
028.
.PageSize(20)
029.
.Read(read => read.Action(
"Orgs_Read"
,
"FiscalContacts"
))
030.
.Sort(sort =>
031.
{
032.
sort.Add(x => x.OrgName);
033.
sort.Add(x => x.OrgType);
034.
})
035.
)
036.
.Events(events => events.DataBound(
"dataBound"
))
037.
)
038.
039.
@section scripts {
040.
<script id=
"template"
type=
"text/kendo-tmpl"
>
041.
@(Html.Kendo().Grid<FiscalContactViewModel>()
042.
.Name(
"Grid_#=OrgType#_#=OrgId#"
)
// template expression, to be evaluated in the master context
043.
.Columns(columns =>
044.
{
045.
//columns.Command(command => { command.Edit(); }).Width(250);
046.
columns.Bound(o => o.Id).Hidden(
true
);
047.
columns.Bound(o => o.SalesforceId).Hidden(
true
);
048.
columns.Bound(o => o.LastName);
049.
columns.Bound(o => o.FirstName);
050.
columns.Bound(o => o.Title);
051.
columns.Bound(o => o.Email);
052.
columns.Bound(x => x.ExecComm).Title(
"Exec"
).Width(75).Filterable(
true
).ClientTemplate(
"\\#=ExecComm ? 'Yes': ''\\#"
).HtmlAttributes(
new
{ style =
"text-align:center"
});
053.
columns.Bound(o => o.Roles);
054.
columns.Bound(o => o.FiscalPermissions).Title(
"Perms"
).Width(75);
055.
})
056.
.ToolBar(tools =>
057.
{
058.
//tools.Create();
059.
tools.Excel();
060.
})
061.
.Excel(excel => excel
062.
.FileName(
"Fiscal Contacts.xlsx"
)
063.
.Filterable(
true
)
064.
.AllPages(
true
)
065.
.ProxyURL(Url.Action(
"Excel_Export_Save"
,
"FiscalContacts"
))
066.
)
067.
001.
@(Html.Kendo().Grid<OrgViewModel>()
002.
.Name(
"Grid"
)
003.
.Columns(columns =>
004.
{
005.
columns.Bound(e => e.OrgType).Hidden(
true
);
006.
columns.Bound(e => e.OrgId).Hidden(
true
);
007.
columns.Bound(e => e.OrganizationType).Title(
"Partner or Charter"
);
008.
columns.Bound(e => e.OrgName).Title(
"Name"
);
009.
})
010.
.Filterable(filterable => filterable
011.
.Extra(
false
)
012.
.Operators(operators => operators
013.
.ForString(str => str.Clear()
014.
.StartsWith(
"Starts with"
)
015.
.IsEqualTo(
"Is equal to"
)
016.
.IsNotEqualTo(
"Is not equal to"
)
017.
))
018.
)
019.
.Groupable()
020.
.Pageable(m => m.PageSizes(
new
[] {
"20"
,
"50"
,
"100"
,
"All"
}))
021.
.Resizable(resizable => resizable.Columns(
true
))
022.
.Sortable()
023.
.Scrollable(s => s.Enabled(
true
))
024.
.ClientDetailTemplateId(
"template"
)
025.
.HtmlAttributes(
new
{ style =
"height:850px;"
})
026.
.DataSource(dataSource => dataSource
027.
.Ajax()
028.
.PageSize(20)
029.
.Read(read => read.Action(
"Orgs_Read"
,
"FiscalContacts"
))
030.
.Sort(sort =>
031.
{
032.
sort.Add(x => x.OrgName);
033.
sort.Add(x => x.OrgType);
034.
})
035.
)
036.
.Events(events => events.DataBound(
"dataBound"
))
037.
)
038.
039.
@section scripts {
040.
<script id=
"template"
type=
"text/kendo-tmpl"
>
041.
@(Html.Kendo().Grid<FiscalContactViewModel>()
042.
.Name(
"Grid_#=OrgType#_#=OrgId#"
)
// template expression, to be evaluated in the master context
043.
.Columns(columns =>
044.
{
045.
//columns.Command(command => { command.Edit(); }).Width(250);
046.
columns.Bound(o => o.Id).Hidden(
true
);
047.
columns.Bound(o => o.SalesforceId).Hidden(
true
);
048.
columns.Bound(o => o.LastName);
049.
columns.Bound(o => o.FirstName);
050.
columns.Bound(o => o.Title);
051.
columns.Bound(o => o.Email);
052.
columns.Bound(x => x.ExecComm).Title(
"Exec"
).Width(75).Filterable(
true
).ClientTemplate(
"\\#=ExecComm ? 'Yes': ''\\#"
).HtmlAttributes(
new
{ style =
"text-align:center"
});
053.
columns.Bound(o => o.Roles);
054.
columns.Bound(o => o.FiscalPermissions).Title(
"Perms"
).Width(75);
055.
})
056.
.ToolBar(tools =>
057.
{
058.
//tools.Create();
059.
tools.Excel();
060.
})
061.
.Excel(excel => excel
062.
.FileName(
"Fiscal Contacts.xlsx"
)
063.
.Filterable(
true
)
064.
.AllPages(
true
)
065.
.ProxyURL(Url.Action(
"Excel_Export_Save"
,
"FiscalContacts"
))
066.
)
067.
//.Editable(editable => editable.Mode(GridEditMode.InCell))
068.
.DataSource(dataSource => dataSource
069.
.Ajax()
070.
.PageSize(10)
071.
.Read(x => x.Action(
"ListContacts"
,
"FiscalContacts"
,
new
{ orgType =
"#=OrgType#"
, orgId =
"#=OrgId#"
}))
072.
.Create(x => x.Action(
"FiscalContacts_Create"
,
"FiscalContacts"
,
new
{ orgType =
"#=OrgType#"
, orgId =
"#=OrgId#"
}))
073.
.Update(x => x.Action(
"FiscalContacts_Update"
,
"FiscalContacts"
))
074.
.Model(model =>
075.
{
076.
model.Id(x => x.Id);
077.
model.Field(x => x.Id).Editable(
false
);
078.
model.Field(x => x.FiscalPermissions).Editable(
false
);
079.
}).Sort(sort =>
080.
{
081.
sort.Add(x => x.LastName);
082.
sort.Add(x => x.FirstName);
083.
})
084.
)
085.
.Filterable(filterable => filterable
086.
.Extra(
false
)
087.
.Operators(operators => operators
088.
.ForString(str => str.Clear()
089.
.StartsWith(
"Starts with"
)
090.
.IsEqualTo(
"Is equal to"
)
091.
.IsNotEqualTo(
"Is not equal to"
)
092.
))
093.
)
094.
.Groupable()
095.
.HtmlAttributes(
new
{ style =
"height:600px;"
})
096.
.Pageable(m => m.PageSizes(
new
[] {
"20"
,
"50"
,
"100"
,
"All"
}))
097.
.Resizable(resizable => resizable.Columns(
true
))
098.
.Sortable()
099.
.Scrollable(s => s.Enabled(
true
))
100.
.ToClientTemplate()
101.
)
102.
</script>
103.
<script>
104.
function
dataBound() {
105.
this
.expandRow(
this
.tbody.find(
'tr.k-master-row'
).first());
106.
}
107.
</script>
108.
}
.Editable(editable => editable.Mode(GridEditMode.InCell))
068.
.DataSource(dataSource => dataSource
069.
.Ajax()
070.
.PageSize(10)
071.
.Read(x => x.Action(
"ListContacts"
,
"FiscalContacts"
,
new
{ orgType =
"#=OrgType#"
, orgId =
"#=OrgId#"
}))
072.
.Create(x => x.Action(
"FiscalContacts_Create"
,
"FiscalContacts"
,
new
{ orgType =
"#=OrgType#"
, orgId =
"#=OrgId#"
}))
073.
.Update(x => x.Action(
"FiscalContacts_Update"
,
"FiscalContacts"
))
074.
.Model(model =>
075.
{
076.
model.Id(x => x.Id);
077.
model.Field(x => x.Id).Editable(
false
);
078.
model.Field(x => x.FiscalPermissions).Editable(
false
);
079.
}).Sort(sort =>
080.
{
081.
sort.Add(x => x.LastName);
082.
sort.Add(x => x.FirstName);
083.
})
084.
)
085.
.Filterable(filterable => filterable
086.
.Extra(
false
)
087.
.Operators(operators => operators
088.
.ForString(str => str.Clear()
089.
.StartsWith(
"Starts with"
)
090.
.IsEqualTo(
"Is equal to"
)
091.
.IsNotEqualTo(
"Is not equal to"
)
092.
))
093.
)
094.
.Groupable()
095.
.HtmlAttributes(
new
{ style =
"height:600px;"
})
096.
.Pageable(m => m.PageSizes(
new
[] {
"20"
,
"50"
,
"100"
,
"All"
}))
097.
.Resizable(resizable => resizable.Columns(
true
))
098.
.Sortable()
099.
.Scrollable(s => s.Enabled(
true
))
100.
.ToClientTemplate()
101.
)
102.
</script>
103.
<script>
104.
function
dataBound() {
105.
this
.expandRow(
this
.tbody.find(
'tr.k-master-row'
).first());
106.
}
107.
</script>
108.
}