How to add link to header text or bodyTemplate tile

1 Answer 61 Views
Templates TileLayout
Riley
Top achievements
Rank 1
Riley asked on 15 Jun 2022, 01:38 PM

I am trying to use tileLayout to display the names and logos of commonly used applications. 

To achieve this, I would like to have the image in the body of the card to be clickable and redirect to its respective URL. Currently I am getting an Invalid Template error.


    <script id="header_@action.Id" type="text/x-kendo-template">

      <a href="@action.Url">@action.Label</a>

    </script>

1 Answer, 1 is accepted

Sort by
0
Georgi Denchev
Telerik team
answered on 20 Jun 2022, 08:12 AM

Hi, Riley,

The most common reason for an "invalid template" error is if an unescaped "#" symbol is present anywhere in the template. These characters must be escaped with a slash "\".

Example:

  <script id="header_@action.Id" type="text/x-kendo-template">

      <a href="https://someurl.something/#">My label # some words</a>

    </script>

The highlighted parts will cause an error. In order to fix the issue, they must be escaped:

  <script id="header_@action.Id" type="text/x-kendo-template">

      <a href="https://someurl.something/\#">My label \# some words</a>

    </script>

Since I don't see any "#" characters in the provided example, my guess is that "@action.Url" returns a url that contains one. Check if that is the case and apply the above suggestion.

If this doesn't help, could you please provide me with a runnable Dojo or small project where the problem can be observed? I should be able to present you with the correct solution afterwards.

Best Regards,
Georgi Denchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Templates TileLayout
Asked by
Riley
Top achievements
Rank 1
Answers by
Georgi Denchev
Telerik team
Share this question
or