Accessing fields in a grid column using C#

2 posts, 1 answers
  1. Reid
    Reid avatar
    431 posts
    Member since:
    Oct 2008

    Posted 23 Jan 2017 Link to this post

    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>&nbsp; <strong>#= ParentTest #</strong></li>   


        // How would I get the value of this var?

       var parentTest = ?





  2. Answer
    Dimiter Topalov
    Dimiter Topalov avatar
    1047 posts

    Posted 25 Jan 2017 Link to this post

    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 = "...";
            "<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:

    You can also inspect the Grid row template online demo (also available in the offline demos application).

    I hope this helps.

    Dimiter Topalov
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top