3

I have a multiline TextBox whose .Text property get saved in an SQL 2008 DB. When I submit the TextBox, I loose the returns. How do I handle this?

I've used Enviroment.Newline() to do some HTML conversion stuff, but I've never ran into this specific problem.

Edit: Nevermind, it was working just fine, but I was replacing "\n" incorrectly. Stupid mistake. I have to convert the "\n" to <p> tags. I've done this before, but if anybody wants to answer, I'll mark their answer as correct.

informatik01
  • 15,174
  • 9
  • 67
  • 100
Dave
  • 31
  • 1
  • 2
  • possible duplicate of [Best practices: displaying text that was input via multi-line text box](http://stackoverflow.com/questions/3007024/best-practices-displaying-text-that-was-input-via-multi-line-text-box) – egrunin Sep 24 '10 at 19:02
  • 2
    You can just answer your own question and mark that as correct. – Dan Diplo Sep 24 '10 at 19:06
  • For some reason I don't see an edit history here.... – NotMe Sep 24 '10 at 19:11

1 Answers1

5

You've solved your own question already, which is great.

But I would comment on one thing: You say you're replacing \n with <p> but the way it sounds like you're doing it, I'd suggest replacing with <br> instead.

Cheers. -S.

Spudley
  • 157,081
  • 38
  • 222
  • 293
  • 1
    @BH In XHTML, it's
    . In HTML,
    or
    work (see http://stackoverflow.com/questions/3558119/are-self-closing-tags-valid-in-html5).
    – Max Nanasy Jan 03 '13 at 22:07