2

I have a problem with GridMvc library. I want to add column which contains joined table of string with
delimiter, here is my code:

columns.Add()
       .RenderValueAs(
           row => string.Join(
               HttpContext.Current.Server.HtmlEncode("<br/>"),
               row.QuestionDifficultyToPosition.Select(
                   r => r.Difficulty.DifficultyName).ToArray()))
       .Titled("Difficulties")
       .Filterable(true)
       .Sortable(true);

but in the result i get:

Easy&lt;br/&gt;Hard

Do you have any ideas why it doesn't work?

davmos
  • 9,324
  • 4
  • 40
  • 43
duch1989
  • 97
  • 7

1 Answers1

1

You're seeing the encoded <br/>, so you need to remove your call to the HtmlEncode() method. Also, from the docs...

you need to disable default encoding and satinizing cell values, using Encoded and Sanitized method.

columns.Add()
       .Encoded(false)
       .Sanitized(false)
       .RenderValueAs(
           row => string.Join(
               "<br/>",
               row.QuestionDifficultyToPosition.Select(
                   r => r.Difficulty.DifficultyName).ToArray()))
       .Titled("Difficulties")
       .Filterable(true)
       .Sortable(true);
davmos
  • 9,324
  • 4
  • 40
  • 43