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

Server Bind - ClientTemplate/Template Conditional Logic

1 Answer 139 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 1
Joel asked on 18 Mar 2019, 09:05 PM

Hello,

I understand that ClientTemplate does not work within A server bound grid, I was curious as to how would you be able to create a conditional statement such as 

                    .ClientTemplate(
                        "# if (tmpIsActive && Active == 1) { # " +
                        "Sales" +
                        " # } else if (tmpIsActive && Active == 2) { # " +
                        "Corp" +
                        "# } #"
                    )

to be used on a server bound grid.

Thanks,

Joel

 

1 Answer, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 20 Mar 2019, 02:02 PM
Hi Joel,

You could achieve the same using a server template as follows:

columns.Bound(p => p.Field).Template(@<text>
        @if (item.tmpIsActive && item.Active == 1)
        {
           <span>Sales</span>
        }
        else if(item.tmpIsActive && item.Active == 1)
        {
            <span>Corp</span>
        }</text>);



Regards,
Georgi
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Joel
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Share this question
or