This is a migrated thread and some comments may be shown as answers.

Accessing fields in a grid column using C#

1 Answer 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Reid
Top achievements
Rank 2
Reid asked on 23 Jan 2017, 07:42 PM

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 = ?

}

 

Thanks

 

1 Answer, 1 is accepted

Sort by
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:

http://docs.telerik.com/kendo-ui/framework/templates/overview

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

I hope this helps.

Regards,
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.
Tags
Grid
Asked by
Reid
Top achievements
Rank 2
Answers by
Dimiter Topalov
Telerik team
Share this question
or