I have the following hierarchy grid that is server bound. In the DetailTemplate I have tried 2 columns containing a Url.Action link. The .ClientTemplate column does not render to the page as an anchor. The .Template column has a syntax error at the @<text>. How can I get a Url.Action column to render in the expansion hierarchy?
Thanks.
Dan
Code:
Thanks.
Dan
Code:
@model IEnumerable<
EquipmentsSummary
>
<
div
class
=
"info-row"
>
@(Html.Kendo().Grid(Model)
.Name("EquipmentGrid")
.Columns(columns =>
{
columns.Bound(e => e.ID).Hidden();
columns.Bound(e => e.PatientId).Hidden();
columns.Template(@<
text
>
<
a
href
=
"@Url.Action("
EquipmentSettingEdit", Controllers.Employee, new {
equipmentid
=
item
.ID,
settingid
=
0
}) "
class
=
'btn btn-sm'
>Add</
a
>
</
text
>).Width(75).Title("Add<
br
/>Setting");
columns.Bound(e => e.EquipName).Title("Item Name");
columns.Bound(e => e.SerialNo).Title("Serial #");
columns.Bound(e => e.AssetStatus).Title("Status");
columns.Bound(e => e.AssetStatusDate).Title("Date");
})
.HtmlAttributes(new { style = "height: 500px;" })
.Pageable(pageable => pageable
.PageSizes(true).PageSizes(new int[] { 20, 50, 100 })
.ButtonCount(5))
.Sortable()
.Filterable()
.Scrollable()
.DataSource(dataSource => dataSource.Server()
.PageSize(20))
.DetailTemplate(
@<
text
>
@(Html.Kendo().Grid(item.SettingItems)
.Name("Settings_" + item.ID)
.Columns(columns =>
{
columns.Bound(s => s.SettingID).Hidden();
columns.Bound(s => s.EffectiveDate).Title("Date").Format("{0:g}");
columns.Bound(s => s.AssetStatus).Title("Status");
columns.Bound(s => s.Clinician);
columns.Bound(s => s.SettingID).ClientTemplate(
"<
a
href
=
'" + Url.Action("EquipmentSettingEdit", Controllers.Employee) + "/?equipmentid=#=item.ID#&settingid=#=SettingID#'
" + "
class
=
'btn btn-sm'
>Details</
a
>"
).Width(75).Title("").Filterable(false);
columns.Template(
@<
text
>
<
a
href
=
'@Url.Action("EquipmentSettingCopy", Controllers.Employee)'
class
=
'btn btn-sm'
>Copy</
a
>
</
text
>).Width(75).Title("").Filterable(false);
})
.DataSource(dataSource =>dataSource.Server().PageSize(20))
.Pageable(pageable => pageable
.PageSizes(true).PageSizes(new int[] { 20, 50, 100 })
.ButtonCount(5))
.Sortable()
.Filterable()
.Scrollable()
)
</
text
>
)
.RowAction(row =>
{
if (row.Index == 0)
{
//row.DetailRow.Expanded = true;
}
else
{
var requestKeys = Request.QueryString.Keys.Cast<
string
>();
var expanded = requestKeys.Any(key => key.StartsWith("Settings_" +
row.DataItem.ID) ||
key.StartsWith("SettingItems_" + row.DataItem.ID));
row.DetailRow.Expanded = expanded;
}
})
)
</
div
>