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

[Solved] Checking condition inside client template

1 Answer 277 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Pradeep N
Top achievements
Rank 1
Pradeep N asked on 28 Apr 2010, 07:19 AM
Hi,
I want to check some condition inside the client template. I am displaying certain model properties in ordered list some properties might be null. I want to check if it is null i should not display the template.

 colums.Bound(o => o.Order1) 
                            .ClientTemplate( "<ol><li><#= Order1 #></li>" + "<li><#= Order2 #></li>" + "<li><#= Order3 #></li></ol>" ); 

The any of the order might be null. I want to display only the order that has value. Is there any way to check conditions inside the client template or any workarounds for that.

Thanks in advance,
Pradeep.

1 Answer, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 28 Apr 2010, 07:54 AM
Hi Pradeep N,

Here is a sample of a client template which is using conditions:

ClientTemplate("<# if (OrderID > 10)  { #> <strong><#= OrderID #></strong> <# } else { #> <em><#= OrderID #> <# } #>");


<# is the client-side equivalent equivalent of <% where <#= is the client-side equivalent of <%=.

All the best,
Atanas Korchev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Pradeep N
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Share this question
or