I have a Kendo template that is used to display real-time statuses for contracts and programmed a href tag that was intended to consume a javascript function rather than opening up a link. On my first attempt, I was having problems as I could not program a pound symbol into the Kendo template (like ColdFusion, a pound symbol indicates a variable within a Kendo template), so I escaped it using two pounds and found myself struggling to figure out why my window was suddenly being refreshed. I spent around ten minutes stepping through my code only to find out that the href tag refreshed the entire page, even though it was blank as the double pound sign escaped. On further introspection, this is understandable as I just had inadvertently programmed a typical link. To fix this issue, I used a simple javascript:void(0); within the link, and the javascript function is called without the default href tag opening up the link. Essentially, the void(0) code prevents the default behavior of the link, and it acts like a a href="#". I would not typically use void in other code, but using it within a Kendo MVVM template is an appropriate place. Here is the code:


<script type="text/x-kendo-template" id="myApprovalTemplate">
	/* Note: dynamic vars can be displayed like so: #: myApprovalDs.total() # */
	 /* Alternate row colors. */
	# if(window.altRow) { #
		<tr class='k-alt'>
	# } else { #
		<tr class='k-content'>
		 # } #
         # if(ApprovalId > 0){ #
          	<td class="border">
          	<input type="checkbox" name="approved#: ApprovalId #" id="approved#: ApprovalId #" value="1" /></td>
          	<td class="border">#: ApproverTitle #</td>
          	<td class="border"><a href="javascript:void(0);" onClick="openContractDetailWindow(#: ContractId #, #: ApprovalId #, '')">#: Contract #</a></td>
          	<td class="border">#: Contractor #</td> 
          	<td class="border">pdf</td>
          	<td class="border"></td> 
         #} else {#
          	<td colspan="6"<!---  class="k-loading-image k-loading-color" --->>
          	<br/>There are no contracts eligible for you to approve
         	</td>
         #}#
	 </tr>
        <!--- Toggle the window variable. --->
        # window.altRow = !window.altRow; #
 </script>