I've got a grid with a client template and need to escape the conditional statement active, but I can't work out how to do it.
I've tried
col.Bound(c => c.Active).ClientTemplate("\\# if (Active == true) {#<
button
class
=
'btn btn-success'
>\\#: Active\\#</
button
>#} \\#");
col.Bound(c => c.Active).ClientTemplate("# if (\\Active\\ == true) {#<
button
class
=
'btn btn-success'
>\\#: Active\\#</
button
>#} #");
col.Bound(c => c.Active).ClientTemplate("# if (\\#:Active\\# == true) {#<
button
class
=
'btn btn-success'
>\\#: Active\\#</
button
>#} #");
Template code:
<
script
type
=
"text/x-kendo-tmpl"
id
=
"projectsGridClientTemplate"
>
@(
Html.Kendo().Grid<
TeamProjectViewModel
>().Name("projectGridDetail_#=Id#")
.Columns(col =>
{
col.ForeignKey(c => c.TeamId, (SelectList)ViewBag.Teams);
col.ForeignKey(c => c.ProjectId, (SelectList)ViewBag.Projects);
col.Bound(c => c.Active).ClientTemplate("# if (Active == true) {#<
button
class
=
'btn btn-success'
>\\#: Active\\#</
button
>#}#");
})
.DataSource(ds => { ds.Ajax().Read(r => r.Action("GetTeamProjects", "ResourcePlannerApi", new { @projectId = "#=Id#" })); })
.ToClientTemplate()
)
</
script
>