asp.net中文本框中的新行

问题描述:



我在dotnetnuke中有一个文本框.

我在文本框中的换行符中将"
"替换为\ n,我在localhost尝试了它的工作,但是我将其上传到服务器上却不起作用..

我尝试显示Response.Write结果示例:
" Hello ..
",但不能替换为\ n

下面的代码:

Hi,

i have a textbox in dotnetnuke.

i replace ''
'' into \n for newline in textbox, i try in localhost it''s work, but i upload to server it doesn''t works..

i try to display with Response.Write the result example:
''Hello..
'' but it not work to replace with \n

the code below:

string description = Server.HtmlDecode(b2u.Description).Replace("<br />", "\n");
txtDescription.Text = description;



除了使用\ n之外,还有其他任何方法可以替换
吗?

有人可以帮我吗?



is there any other way to replace
besides using \n?

can somebody help me??

尝试一下

Try this

Replace("<br />", Environment.NewLine);


string Descripion = e.Item.Cells[9].Text.ToString().Trim();
                Descripion = Descripion.Replace("\n", "<br/>");
                e.Item.Cells[9].Text = Descripion.ToString();


<div class="display-field">
    <%: new HtmlString(Model.Body.Replace(Environment.NewLine, "<br />")) %>
</div>