Hi,
We have an issue using IHtmlString properties inside the grid. By default, it displays "[object Object]" in the column since, well, HtmlString is an object. However, this is ASP.NET MVC's way of saying "this string is already html-encoded". As such, I can use @Model.Property to have a property that includes html without re-encoding it. If Property was a simple string, I would have @Html.Raw(Model.Property).
It would be nice if kendo ui's grid was to work like this as well. If we use a string, we can by-pass the html-encoding using a client template ("#= Property #"), however if we have an IHtmlString property, there is no way to display it, since it has no public properties. The only method it has is ToHtmlString(), which is what kendo's grid could use.
We temporarily bypassed this issue using a second property which calls ToHtmlString() on the original property, but native support for this type would be nicer I think.
== Overview
Work :
columns.Bound(Function(vm) vm.PropertyAsString).ClientTemplate("#= Pharmacie.CoordonneesCompletesBruts #")
Works not :
columns.Bound(Function(vm) vm.PropertyAsHtmlString) // Can't work, this is just an object
columns.Bound(Function(vm) vm.PropertyAsHtmlString).ClientTemplate("#= Pharmacie.CoordonneesCompletesBruts #") // Can't work, this is still just an object
columns.Bound(Function(vm) vm.PropertyAsHtmlString).ClientTemplate("#= Pharmacie.CoordonneesCompletesBruts.ToHtmlString #") // Doesn't work, this function is not replicated in JS
columns.Bound(Function(vm) vm.PropertyAsHtmlString.ToHtmlString()) // Doesn't work, not a property expression
==
Thanks,
Jni
PS : I'm posting this in the grid forum, but there are most likely other components which could benifit from this.
PS2 : I know, having properties that return HTML inside a viewmodel might not be the best idea, but, long story short, we have to for this one.
We have an issue using IHtmlString properties inside the grid. By default, it displays "[object Object]" in the column since, well, HtmlString is an object. However, this is ASP.NET MVC's way of saying "this string is already html-encoded". As such, I can use @Model.Property to have a property that includes html without re-encoding it. If Property was a simple string, I would have @Html.Raw(Model.Property).
It would be nice if kendo ui's grid was to work like this as well. If we use a string, we can by-pass the html-encoding using a client template ("#= Property #"), however if we have an IHtmlString property, there is no way to display it, since it has no public properties. The only method it has is ToHtmlString(), which is what kendo's grid could use.
We temporarily bypassed this issue using a second property which calls ToHtmlString() on the original property, but native support for this type would be nicer I think.
== Overview
Work :
columns.Bound(Function(vm) vm.PropertyAsString).ClientTemplate("#= Pharmacie.CoordonneesCompletesBruts #")
Works not :
columns.Bound(Function(vm) vm.PropertyAsHtmlString) // Can't work, this is just an object
columns.Bound(Function(vm) vm.PropertyAsHtmlString).ClientTemplate("#= Pharmacie.CoordonneesCompletesBruts #") // Can't work, this is still just an object
columns.Bound(Function(vm) vm.PropertyAsHtmlString).ClientTemplate("#= Pharmacie.CoordonneesCompletesBruts.ToHtmlString #") // Doesn't work, this function is not replicated in JS
columns.Bound(Function(vm) vm.PropertyAsHtmlString.ToHtmlString()) // Doesn't work, not a property expression
==
Thanks,
Jni
PS : I'm posting this in the grid forum, but there are most likely other components which could benifit from this.
PS2 : I know, having properties that return HTML inside a viewmodel might not be the best idea, but, long story short, we have to for this one.