Hello friends. My second day with Kendo UI for ASP.NET MVC (newbie questions):
tl;dr version:
This:
@Html.HiddenFor(model => model.ProjectID)... lines ommitted for brievity.ClientFooterTemplate("<div style='text-align:right;color:blue;'><a href='" + Url.Action("Index", "PurchaseInvoice/#= ProjectID #")+"'>#= kendo.format('{0:C}',sum)#</a></div>");generates this:
<a href="/PurchaseInvoice/[object HTMLInputElement]">$191,449.65</a>which shows the amount as a link (great). But what I need to be generated is this:
<a href="/PurchaseInvoice/259">$191,449.65</a>... where 259 is the ProjectID.
Note that ProjectID is part of the model, but not of the grid's data. That's likely my problem here.
What am I missing? Is there an easier way to do this?
Long version:
@(Html.Kendo().Grid<DataLibrary.ProjectCost>() .Name("CostGrid") .Columns(columns => { columns.Bound(c => c.Month) .Width(100) .Title("Mois") .Hidden(); columns.Bound(c => c.SupplierName) .Width(300) .Title("<div style='text-align:left;'>Fournisseur </div>") .HtmlAttributes(new { @style = "text-align:left;" }) .ClientFooterTemplate("<div style='text-align:right;'>TOTAL: </div>"); columns.Bound(c => c.OrderAmount) .Format("{0:C}") .Width(100) .Title("Commandé") .HtmlAttributes(new { @style = "text-align:right;" }) .ClientGroupHeaderColumnTemplate("#= kendo.format('{0:C}',sum)#") .ClientFooterTemplate("<div style='text-align:right;'>#= kendo.format('{0:C}',sum)#</div>"); columns.Bound(c => c.InvoiceAmount) .Format("{0:C}") .Width(100) .Title("Facturé") .HtmlAttributes(new { @style = "text-align:right;" }) .ClientGroupHeaderColumnTemplate("#= kendo.format('{0:C}',sum)#") .ClientFooterTemplate("<div style='text-align:right;color:blue;'><a href='" + Url.Action("Index", "PurchaseInvoice/#= projectID #")+"'>#= kendo.format('{0:C}',sum)#</a></div>"); }) .DataSource(dataSource => dataSource .Ajax() .Aggregates(aggregates => { aggregates.Add(c => c.OrderAmount).Sum(); aggregates.Add(c => c.InvoiceAmount).Sum(); }) .Group(groups => { groups.AddDescending(c => c.Month); }) .Read(read => read.Action("CostSummary", "Project", new { ID = Model.projectID })) ) .Events(events => events.DataBound("collapseGroupRows")))
I've tried many variations:
.ClientFooterTemplate("<div style='text-align:right;color:blue;'>#= kendo.format('{0:C}',sum)#</div>");.ClientFooterTemplate("<div style='text-align:right;color:blue;'><a href='/PurchaseInvoice?ProjectID=#=projectID#'>#= kendo.format('{0:C}',sum)#</a></div>");.ClientFooterTemplate("<div style='text-align:right;color:blue;'><a href='/PurchaseInvoice?ProjectID=#=projectID#>#= kendo.format('{0:C}',sum)#</a></div>");.ClientFooterTemplate("<div style='text-align:right;color:blue;'><a href='/PurchaseInvoice?ProjectID=#=projectID#>#= kendo.format('{0:C}',sum)#</a></div>");.ClientFooterTemplate(@Html.ActionLink("#= kendo.format('{0:C}',sum)#","Index", "PurchaseInvoice", new { ProjectID = "#= projectID#" }, null).ToHtmlString());.ClientFooterTemplate(@Html.ActionLink("#= kendo.format('{0:C}',sum)#","Index", "PurchaseInvoice", new { ProjectID = "#=projectID#" }, new { @style = "text-align:right;color:blue;" }).ToHtmlString());.ClientFooterTemplate(@Html.ActionLink("#= kendo.format('{0:C}',sum)#","Index", "PurchaseInvoice", new { ProjectID = "#= projectID#" }, null ).ToHtmlString());.ClientFooterTemplate(@Html.ActionLink("#= kendo.format('{0:C}',sum)#","Index", "PurchaseInvoice", new { ProjectID = "#= projectID#" }, null ).ToHtmlString());
Perhaps one of these is a (almost) better implementation (none of these work as-is though).
Thanks
