views:

87

answers:

1

I want to take an EventLog entry which has a stack trace in its Message and bind it to a GridView. If I use Eval("Message") and put it in a label or a < p >, it displays, but the stack trace is smashed together.

If I Eval it in a TextBox, it keeps its formatting.

Is there a way to evaluate this stacktrace value to some sort of literal-type control and preserve formatting?

I've tried Server.HtmlEncode(Eval("Message")) without success.

+3  A: 

It sounds like you need to convert the newlines to HTML linebreaks. Try something like this:

String htmlMessage = e.Message.Replace("\n", "<br/>");
Andrew Hare
It doesn't solve all of the indenting that was in place, but I know where to go from here. Thanks!
Macho Matt