2014-02-25 72 views
0

我想將IsActive列的值從真假是和否更改代碼如下:劍道的GridView單元格值別名

   @(Html.Kendo().Grid<Silverback.Vitae.Core.Models.FormModel>() 
.Name("Grid") 
.Columns(columns => 
{ 
    columns.Bound(p => p.Name); 
    columns.Bound(p => p.IsActive).Width(100).HeaderHtmlAttributes(new { @style = "text-align:center;" }).HtmlAttributes(new { @style = "text-align:center;" }); 
    columns.Bound(p => p.FormID).ClientTemplate("#= actionTemplate(data) #").Width(300).HeaderHtmlAttributes(new { @style = "text-align:center;" }).HtmlAttributes(new { @style = "text-align:center;" }).Title("Action").Sortable(false); 

}) 
.Pageable() 
.Sortable() 
.Scrollable(s => s.Height("auto")) 
.DataSource(dataSource => dataSource 
    .Ajax() 
    .Read(read => read.Action("GetForms", "Forms")) 
) 

回答

1

ClientTemplate是東西將帶給你成功。常見問題解答here也有相同的解釋。

ClientTemplate(「#= IsActive?'Foo':'Bar'#」)