Could you elaborate on this a bit more please. I have a similar situation in that I am trying to create a dropdown list item template which would contain an HTML encoded string that needs to be rendered as actual HTML in the View. I'm not quite sure that I understand how to implement the function that you have provided within the template.
Here is what I have so far...
<
script
type
=
"text/x-kendo-template"
id
=
"formatted-currency"
>
# function htmlDecode(value) { #
return value.replace(/</
g
, '<').replace(/>/g, '>');
# } #
<
div
class
=
'x'
> #= data.x #</
div
>
<
div
class
=
'y'
> #= data.y #</
div
>
<
div
class
=
'z'
> #= htmlDecode(data.z) #</
div
>
</
script
>
Which is consumed by the dropdown via html helper extension like so...
@(Html.Kendo().DropDownList()
.BindTo(Model.Accounts)
.DataTextField("x")
.DataValueField("i")
.HtmlAttributes(new { @style = "width: 300px" })
.Height(250)
.OptionLabel("Please select...")
.Name("x.i")
.TemplateId("formatted-currency"))
In the view, the values for 'x' and 'y' are properly rendered, but the value for 'z' is rendered as 'undefined'. Any help with where I am going wrong would be great.