How to reference item properties in template using mvc helpers

2 posts, 0 answers
  1. Leandro
    Leandro avatar
    1 posts
    Member since:
    Jun 2011

    Posted 05 Jun 2013 Link to this post

    Hello !

    Please help me with this. I'm trying to reference an item property in a helper function inside the template. How can I do this ?

    <script type="text/x-kendo-tmpl" id="template">
        <div class="process-view">
            <div class="edit-buttons">
                @(Html.ActionLink("Create New", "Process_Create", "Process",
                    new { id=${ProcessID} }))
            </div>
            <dl>
                <dt>Code</dt>
                <dd>${ProcessCode}</dd>
                <dt>Name</dt>
                <dd>${Name}</dd>
                <dt>Description</dt>
                <dd>${Description}</dd>
                <dt>ID</dt>
                <dd>${ProcessID}</dd>
            </dl>
        </div>
    </script>
    The problem is that the compiler tries to solve the item reference and throws a
    CS1056: Unexpected character '$'

    I've also tried with #:ProcessID#, and get 
    CS1040: Preprocessor directives must appear as the first non-whitespace character on a line

    What should I do ?

    Thanks,

    Leandro
  2. Dimo
    Admin
    Dimo avatar
    8333 posts

    Posted 06 Jun 2013 Link to this post

    Hi Leandro,

    You cannot use client-side binding expressions such as ${...} and #:...# for server-side HTML helpers. Please replace the ActionLink helper with a plain anchor tag <a href="...">.

    In addition, please avoid posting duplicate forum threads.

    Regards,
    Dimo
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top