Google+

Friday, March 8, 2013

Checking condition inside client template in Telerik Grid ASP.NET MVC Razor.

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 empty i should not display the template.


colums.Bound(o => o.Order1).ClientTemplate( "
  1. <#= Order1 #>
  2. " + "
  3. <#= Order2 #>
  4. " + "
  5. <#= Order3 #>
" ); 



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

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


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

1 comment: