Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dumping raw html to a Telerik grid

I have an MVC3 app that uses a Telerik grid. I have a variable with html in it i want to display raw:

   o.RawHtml = "This is a <br/> Test";

   @(Html.Telerik().Grid(Model)
   .Columns(columns =>
    {
        columns.Bound(o => o.RawHtml).ClientTemplate("<#= RawHtml #>").Title("Raw");

       })

According to Telerik samples, this should work, but it doesnt. The output in a browser shows
"This is a < br/> Test"

and not the desired:

  This is a
  Test

Any ideas? Thanks

like image 771
BoundForGlory Avatar asked May 17 '12 20:05

BoundForGlory


1 Answers

Have you tried setting the Encoded property of the column to false? This page gives some information.

<%= Html.Telerik().Grid(Model)
    .Name("Orders")
    .Columns(columns =>
    {
        columns.Bound(o => o.OrderID).Encoded(false);
    })
%>

By default, columns are html encoded.

like image 172
Lester Avatar answered Oct 19 '22 15:10

Lester