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

Mixing template bound data, and razor url.action

2 Answers 134 Views
Templates
This is a migrated thread and some comments may be shown as answers.
SRV
Top achievements
Rank 1
SRV asked on 22 Apr 2016, 06:46 AM

I've tried various methods of using template bound data with Url.Action with no luck.

<script type="text/x-kendo-template" id="kendo-template">

<a href='@Url.Action("action", "controller", new { id = "#=id"}'>Click me</a>

<script>

It seems that the # character gets encoded, so kendo is not able to render the template with the correct id.

How may I use the kendo-template together with the Url.Action helper?

2 Answers, 1 is accepted

Sort by
0
SRV
Top achievements
Rank 1
answered on 22 Apr 2016, 07:24 AM
I could do a workaround by not using the Url.Action helper, but I would prefer using the helper for easier maintenance.
0
Petyo
Telerik team
answered on 25 Apr 2016, 04:31 PM
Hi,

I think that the syntax you refer to is #=id #. However, even if provided correctly, it won't work, because the encoding you refer to will escape the hash symbol. There is not much that Kendo UI can do here, as the processing happens on the server side and is outside of the library control. 

Regards,
Petyo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Templates
Asked by
SRV
Top achievements
Rank 1
Answers by
SRV
Top achievements
Rank 1
Petyo
Telerik team
Share this question
or