I'm unable to successfully reference a child grid's column data when creating a ClientTemplate
for a column in the child's grid.
This works just fine and shows true/false correctly:
columns.Bound(m => m.Completed).Title("Completed").Width(100);
This does not work:
columns.Bound(m => m.Completed).Title("Completed").Width(100).ClientTemplate(
@"# if (Completed == true) { #" +
"<img src='" + Url.Content("~/Images/") + "checked.png' alt='quest icon' />" +
"# } else { #" +
"#: Completed #" +
"# } #"
);
The value, Completed
, is always null therefore the else
block is always hit and my Completed column just shows null for each row's value.
If I reference a parent grid column within else block I get the correct values so it seems as I'm missing something on how to reference the child columns.
Any direction would be appreciated.
Of course I found the answers about 20 minutes after I posted. You must escape the hash symbols in a nested grid. Credit here:
http://www.telerik.com/forums/conditional-client-template-in-razor-hierarchical-grid