Search code examples
kendo-uikendo-ui-window

Kendo Template - Convert boolean value into yes or no


I have this kendo template and i am trying to convert the isDiscount boolean value into yes/no. Please suggest how can i perform this conversion.

 <script type="text/x-kendo-template" id="template">
            <div id="details-container">
                <h2>#= Name # </h2>
                <em>#= Description #</em>
                <dl>
                  <dt>Price: #= kendo.toString(Price, "c")#</dt>                
                  <dt>Discount available: #= isDiscount #</dt>
                </dl>
            </div>
      </script>

Solution

  • You can use the conditional conversion inline like that:

    <dt>Discount available: #if(isDiscount){# Yes#} else {# No#}#</dt>
    

    There is also a demo here