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

template is encoding results from function

1 Answer 168 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 09 Mar 2012, 01:21 AM
Hello all,

I have a template in a column in which I want to dive into logic and show or now show a link based on other values

{ title: "Job Location Notes", template: "${ showLogLink(JobLocationNotes,JobID) }" },


and the function is something simple like 

function showLogLink(JobLocationNotes, JobID) {
 
    if (JobLocationNotes != null && JobLocationNotes != "") {
        return JobLocationNotes + " <a href='javaScript:;' data-url='../ModalWindows/JobLocationNotes.aspx' title='Location Notes' class='jobLocationLink' data-id='" + JobID + "'>Log</a>";
    }
    else {
        return "";
    }
 
}


It works except the output is encoded.
So instead of seeing "Log"
I see " <a href='javaScript:;' data-url='../ModalWindows/JobLocationNotes.aspx' title='Location Notes' class='jobLocationLink' data-id='7'>Log</a> "

Thanks!

1 Answer, 1 is accepted

Sort by
0
Accepted
Alexander Valchev
Telerik team
answered on 09 Mar 2012, 09:00 AM
Hello Jeremy,

Please note that the template syntax ${ foo } is encoding the html. In your case the suitable template expression is #= foo #. In the corresponding documentation you can find more information and examples on this topic.

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