开发者

Preserve Line Breaks in ASP.NET Textbox

开发者 https://www.devze.com 2023-01-18 00:22 出处:网络
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 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" t开发者_如何学编程o <p> tags. I've done this before, but if anybody wants to answer, I'll mark their answer as correct.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消