我的客户端模板开始非常大,我希望能够将其放入<script>
我的两个问题是:
以下是我现在想要改变的内容:
@(Html.Kendo().Grid<Car>()
.Name("testGrid)
.BindTo(Model.CarList)
.Columns(columns =>
{
columns.Bound(a => a.CarInitialAndNumber)
.Width(150)
.IncludeInMenu(false)
.HtmlAttributes(new { title = "#=CarInitialAndNumber#" })
.ClientTemplate(
"#=CarInitialAndNumber# <span role=\"menuitem\" class='glyphicon glyphicon-plus jqtooltip k-header-column-menu' " +
"title='<table class=\"uitooltip\">" +
"<tr><td><span>" + Resources.CarGrid_Column_CCO + ":</span></td><td>#=CCO#</td><td><span>" + Resources.CarGrid_Column_Length + ":</span></td><td>#=Length#</td></tr>" +
"<tr><td><span>" + Resources.CarGrid_Column_NetWeight + ":</span></td><td>#=NetWeight#</td></tr>" +
"<tr><td><span>" + Resources.CarGrid_Column_Pool + ":</span></td><td>#=Pool#</td><td><span>" + Resources.CarGrid_Column_Shipper + ":</span></td><td>#=Shipper#</td></tr>" +
"<tr><td><span>" + Resources.CarGrid_Column_Origin + ":</span></td><td colspan=\"3\">#=OriginFacility#</td></tr></table>'" +
" style='float:right;line-height:10px;margin-top:4px'></span>"
)
.Title(Resources.CarGrid_Column_CarInitialNumber);
})
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("GetCars", "controller").Data("getCriteria"))
)
.Events(o => o.DataBound("onCarDatabound"))
但是我想把它放在那样的东西(2个不同的模板.1用于容器,另一个用于工具提示。):
<script id="detail-template" type="text/x-kendo-template">
#=CarInitialAndNumber#
<span role="menuitem" class='glyphicon glyphicon-plus jqtooltip k-header-column-menu'
title="#=UseToolTipTemplate#"
style="float:right;line-height:10px;margin-top:4px">
</span>
</script>
<script id="detailtooltip-template" type="text/x-kendo-template">
<table class="uitooltip">
<tr>
<td>
<span>@(Resources.CarGrid_Column_CCO) :</span>
</td>
<td>#=CCO#</td>
<td>
<span>@(Resources.CarGrid_Column_Length) :</span>
</td>
<td>#=Length#</td>
</tr>
<tr>
<td>
<span>@(Resources.CarGrid_Column_NetWeight) :</span>
</td>
<td>#=NetWeight#</td>
</tr>
<tr>
<td>
<span>@(Resources.CarGrid_Column_Pool) :</span>
</td>
<td>#=Pool#</td>
<td>
<span>@(Resources.CarGrid_Column_Shipper) :</span>
</td>
<td>#=Shipper#</td>
</tr>
<tr>
<td>
<span>@(Resources.CarGrid_Column_Origin) :</span>
</td>
<td colspan="3">#=Origin#</td>
</tr>
</table>
</script>
我只是不知道如何将此特定clientTemplate的值设置为我脚本中的值。