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

How put use Razor code in a template in MVC?

2 Answers 607 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 2
Ian asked on 16 Jul 2013, 08:49 PM
I'm converting a web site that puts complex Razor code into a TD cell. How is Razor code put into a template on a Kendo Grid?

Sample of the code that needs to get run and put into a cell:

@if (item.IsActionAvailable())
      {
       using (Html.BeginForm("Subscribe", "abc", FormMethod.Post, new { id = @formId }))
                       {
                               <div id="@divId" class="subForm">

2 Answers, 1 is accepted

Sort by
0
Accepted
Ian
Top achievements
Rank 2
answered on 16 Jul 2013, 09:17 PM
I found this to be the answer:

columns.Bound(e => e.DisplayText).Template(
    @<text>
         @if (item.IsActionAvailable())
         {
0
Dimiter Madjarov
Telerik team
answered on 17 Jul 2013, 06:26 AM
Hello Ian,


Yes, this is the correct approach if the Grid is using server binding. With ajax binding a client template should be used.

Please let me know if I could assist you further. I wish you a great day!

 

Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Ian
Top achievements
Rank 2
Answers by
Ian
Top achievements
Rank 2
Dimiter Madjarov
Telerik team
Share this question
or