Is it possible to access the data of a column/field in a template like a row template in a razor template?
for instance : <li><label>Parent Test :</label> <strong>#= ParentTest #</strong></li>
@{
// How would I get the value of this var?
var parentTest = ?
}
Thanks
1 Answer, 1 is accepted
0
Accepted
Dimiter Topalov
Telerik team
answered on 25 Jan 2017, 12:00 PM
Hello Reid,
I am not sure I fully understand the question, but it is not possible to access a value created, and evaluated on the client, in the server-side code. You can pass C# variables to the template, e.g.:
//.cshtml file
@{
var test = "...";
}
...
.ClientRowTemplate(
"<tr data-uid='#: uid #'>" +
...
"<td class='details'>" +
"<span class='title'>#: Title # " + @test + "</span>" +...
... but not the other way around.
Further information about Kendo UI templates is available in the following section of our documentation: