mardi 25 mars 2014

kendo grid mvc client template with multiple params


Vote count:

0




Here is the grid:



this.Html.Kendo().Grid<Model>()
.Name("grid")
.Filterable()
.ColumnMenu()
.Sortable()
.Groupable()
.Columns(col =>
{
col.Bound(x => x.CompanyId).Visible(false);
col.Template(x => x.CompanyName).ClientTemplate(Html.ActionLink("#= CompanyName #>", "Update", "AppCompany", new { id = "#= CompanyId #", panel = 1 }, null).ToHtmlString()).Width(120);
})
.Pageable(pageable => pageable
.ButtonCount(5)
.Info(true))
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(25)
.Read(read => read.Action("GetData", "EmployeeHistory").Data("sendAntiForgery")))


I am trying to use both CompanyName and CompanyId to render the ActionLink.


col.Template(x => x.CompanyName).ClientTemplate(Html.ActionLink("#= CompanyName #>", "Update", "AppCompany", new { id = "#= CompanyId #", panel = 1 }, null).ToHtmlString()).Width(120);


When the grid renders, I get this error in javascript:


Uncaught ReferenceError: companyid is not defined


CompanyId is in a nav property a couple of domain model levels down, but I have mapping set up with Deflattening so Kendo knows where to find it for sorting/grouping, etc.


The question is, how can I get this to work?


Thanks!


Mike



asked 58 secs ago






Aucun commentaire:

Enregistrer un commentaire