Mixing template bound data, and razor url.action

3 posts, 0 answers
  1. SRV
    SRV avatar
    5 posts
    Member since:
    Sep 2012

    Posted 22 Apr Link to this post

    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>


    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. SRV
    SRV avatar
    5 posts
    Member since:
    Sep 2012

    Posted 22 Apr in reply to SRV Link to this post

    I could do a workaround by not using the Url.Action helper, but I would prefer using the helper for easier maintenance.
  3. Kendo UI is VS 2017 Ready
  4. Petyo
    Petyo avatar
    2439 posts

    Posted 25 Apr Link to this post


    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. 

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top