I have a Kendo grid that displays the Grid with Details being a Tab. The first tab basically renders a different partial view based on the Row's StatusID column. The "if" condition within the .Content() method of the tab item script in the template just does not work. The if condition is always false and falls into the “else” block. Is there a specific syntax to get the parent field's value to compare? I tried using the escape characters \\ before the pre-processor character #
Thanks!
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.Name).Groupable(false);
columns.Bound(p => p.StatusName).Width(100);
columns.Bound(p => p.Description).Title("Description").Width(150);
columns.Bound(p => p.City).Width(100);
columns.Bound(p => p.State).Width(70);
columns.Bound(p => p.AssignedTo);
@*
columns.Command(command => command.Custom("View Details").Click("showDetails"));
*@
})
.ClientDetailTemplateId("detailsTemplate")
.Pageable()
.Sortable()
.Scrollable(src => src.Height(500))
.Filterable()
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("ViewDetails", "Site"))
.PageSize(20)
)
.Events(events =>
{
events.DataBound("dataBoundDetails");
events.DetailExpand("expandDetails");
})
)
@(Html.Kendo().Window().Name("Details")
.Title("Site Details")
.Visible(false)
.Modal(true)
.Draggable(true)
.Width(500)
)
<script id="detailsTemplate" type="text/kendo-tmpl">
@(Html.Kendo().TabStrip()
.Name("TabStrip_#=Id#")
.SelectedIndex(0)
.Items(items =>
{
//Main
items.Add()
.Text("Details")
.Encoded(false)
.Content(@<text>
@if("#= StatusId #" == "1")
{
@Html.Action("SiteRequestView", "Site")
}
else
{
@Html.Action("EvaView", "Site")
}
</text>);
})
.ToClientTemplate())
</script>