Hi!
I have this scenario where I want to forward the current model's sub-object as a model to a DisplayTemplate within the Grid's ClientDetailTemplate: Checkout the first Tab of the TabStrip in the ClientDetailTemplate
Main View:
@(Html.Kendo().Grid(Model)
.Name("gridLetters")
.Columns(columns =>
{
columns.Bound(p => p.Id).ClientTemplate("<a href='" + Url.Action("View", "Letter", new { letterId = "#:Id#" }) + "'>#=Id#</i></a>");
columns.Bound(p => p.Subject);
columns.Bound(p => p.CompanyName).Title("Company");
columns.Bound(p => p.BrandName).Title("Brand");
columns.Bound(p => p.Location.Name).Title("Location");
columns.Bound(p => p.LetterType.Name).Title("RL Type");
})
.ToolBar(toolbar =>
{
toolbar.Search();
})
.Sortable()
.Navigatable()
.Resizable(r => r.Columns(true))
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.Filterable()
.Scrollable()
.ClientDetailTemplateId("detailTemplate")
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Ajax()
.Sort(x => x.Add("Id").Descending())
.PageSize(20)
.ServerOperation(false)
))
@section Scripts {
<script id="detailTemplate" type="text/kendo-tmpl">
@(Html.Kendo().TabStrip()
.Name("tabStrip_#=Id#")
.SelectedIndex(0)
.Animation(animation => animation.Open(open => open.Fade(FadeDirection.In)))
.Items(items =>
{
items.Add().Text("History").Content(@<text>@Html.DisplayFor(m => m.History, "LetterHistory")</text>);
items.Add().Text("Details").Content("");
}).ToClientTemplate())
</script>
}
Above, the model for the main grid is an IList of my objects. Each object has a History property of type
BusApp.Domain.Models.BusinessObjects.LetterActionHistoryFlatModel
I need to get that property passed on as a model for the DisplayFor
LetterHistory.cshtml
@model IList<BusApp.Domain.Models.BusinessObjects.LetterActionHistoryFlatModel>
@(Html.Kendo().Grid(Model)
.Name("gridLetterHistory")
.Columns(columns =>
{
columns.Bound(p => p.ActionStamp).Title("Stamp").Format("{0:dd-MMM-yyyy}");
columns.Bound(p => p.LetterActionName).Title("Action");
columns.Bound(p => p.ActionTakenByName).Title("Taken By");
})
.Navigatable()
.Resizable(r=>r.Columns(true))
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(10))
.Filterable()
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.Sort(x => x.Add("ActionStamp").Descending())
.PageSize(20)
.ServerOperation(false)
)
)
Regrds.
Still waiting for a solution...