asp.net中文本框中的新行 [英] new line in textbox in asp.net

查看:64
本文介绍了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>


这篇关于asp.net中文本框中的新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆