VB.Net
<%# Eval("MyValue").ToString().Replace(vbcrlf,"<br />") %>
C#
<%# Eval("MyValue").ToString().Replace("\r","<br />") %>
Thanks!
It works great!
I was also able to get it going with the following a few minutes ago:
<%# Eval("MyValue").Replace(Environment.NewLine, "<br />") %>
Which method do you recommend or are they both good?
|||With the .NET framework, there are approximately 63 ways to skin most particular cats. The difference between them is most often negligible, and you should use whatever you prefer so long as your page load doesn't appear to be adversely affected. Occasionally you will get a guru tell you to use one option rather than another, because it shaves nanoseconds off the operation, and they will have benchmark tests to prove it. Personally, I think life is too short. I usually use the option that requires less typing, unless I am informed of a convincing reason to use another.
Environment.NewLine has the benefit that it can be used regardless of page language, so I shall use it in future when I answer this question without knowing the language the poster is using. Quite simply, it meets my desire to do less typing.
No comments:
Post a Comment