I'm displaying text in a grid cell that contains line feeds and like normal those line feeds get removed when rendered. The conventional wisdom to preserve line feeds is to apply CSS, something like "white-space: pre-wrap". However when I do that in a Telerik grid cell via
.k-grid td, .k-grid .k-table-td {
white-space: pre-wrap;
}
The rendered td element gets unnecessarily tall, wasting space. I saw this post:
https://www.telerik.com/forums/multi-line-text-in-grid-cell
And with that I was able to get the end result to look okay using this:
<Template>
@(new MarkupString((context as LocationDto).RMRAddress?.DisplayText.Replace(Environment.NewLine, "<br/>")))
</Template>
But I really don't like having to use a markup string like that. Is there a way to apply CSS to the grid cell to preserve the line feeds without creating the unnecessary height? See the attached screenshot. Yellow highlight shows the wasted space I'm referring to.
Thanks.