开发者

Preserve Line Breaks in ASP.NET Textbox

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜