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

How to reference item properties in template using mvc helpers

1 Answer 97 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Leandro
Top achievements
Rank 1
Leandro asked on 05 Jun 2013, 08:37 AM
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

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 06 Jun 2013, 10:24 AM
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!
Tags
ListView
Asked by
Leandro
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or