TextArea / Textbox显示多行的问题 [英] problem with TextArea/Textbox for showing multiple line
问题描述
亲爱的所有人,
我在TextArea / Textbox中遇到典型问题,显示多行。
来自我的数据库价值如下所示
亲爱的xyz \ r \ n希望你好。\\ n你的健康怎么样\\\ nbsp ....
绑定到控件时也行,我在Quick watch / Immediate中看到过窗口。
但是当我在浏览器(IE11)中查看最终输出页面时,它会显示在一行中。
它是发生在文本框以及文本区域和铬也同样错误。
请帮助这个
谢谢
Vamsi
Dear All,
I have typical problem with TextArea/Textbox for showing multiple line.
from my database value is coming as below
"Dear xyz \r\n hope u r good \r\n how about ur health \r\n ...."
when is binding to the control is also OK ,i have seen in the Quick watch/Immediate window.
But when i am looking in the final output page in Browser (IE11) it is showing in a single Line.
It's happening with Text box as well as text area and in chrome also same error.
Please help in this
Thanks
Vamsi
推荐答案
这里的解决方案究竟是什么PBGuy试图解释你..
换行符应替换为< br>标签
str.Replace(@\\\\ n,
);
或
string result = Regex.Replace(input,@\\\\ nn?| \ n,
);
问候,
Praveen Nelge
Hi here the solution what exactly "PBGuy" tried to explain you..
newlines should be replaced by <br> tag
str.Replace(@"\r\n", "
");
or
string result = Regex.Replace(input, @"\r\n?|\n", "
");
Regards,
Praveen Nelge
在你的字符串之前使用'@'符号。
@亲爱的xyz \\\ \\ n \\ n \\ n希望你好。\\\\ n你的健康怎么样\\\\ n ....
希望这能解决你的问题
问候,
Sumit。
use '@' sign before ur string.
@"Dear xyz \r\n hope u r good \r\n how about ur health \r\n ...."
hope this will solve ur problem
Regards,
Sumit.
这篇关于TextArea / Textbox显示多行的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!