C# c中文本区域中的新行#

C# c中文本区域中的新行#,c#,asp.net,C#,Asp.net,我正在开发一个ASP.NET应用程序。文本取自数据库,其中换行符存储为“\r\n”,我将文本放入启用多行的文本框中。 然而,我似乎无法在文本框中插入换行符 string description = description.Replace("\\r\\n", "<br/>"); lblDescriptionV.Text = description; string description=description.Replace(“\\r\\n”和“”); lblDescriptionV

我正在开发一个ASP.NET应用程序。文本取自数据库,其中换行符存储为
“\r\n”
,我将文本放入启用多行的文本框中。 然而,我似乎无法在文本框中插入换行符

string description = description.Replace("\\r\\n", "<br/>");
lblDescriptionV.Text = description;
string description=description.Replace(“\\r\\n”和“
”); lblDescriptionV.Text=说明;
我已尝试将换行符替换为:


和#10但值刚刚打印到文本框中。

因此,它将显示为:
“第1行
第2行”

替换为
环境。换行符
替换为
环境。换行符

<asp:TextBox runat="server" ID="txtArea" TextMode="MultiLine" Rows="10" />
因此,您需要以下内容:

string description = "Hello\\r\\nThere\\r\\nFriend";
description = description.Replace("\\r\\n", "\n");
注意:不能在标签(lblDescriptionV)中输入分隔符

因此,您需要以下内容:

string description = "Hello\\r\\nThere\\r\\nFriend";
description = description.Replace("\\r\\n", "\n");

注意:您不能在标签(lblDescriptionV)

环境中输入分隔符。换行符看起来您可以检查此答案:
环境。换行符看起来您可以检查此答案:谢谢。有点奇怪,我看到的每个地方都说用这个和那个替换“\n”。但它现在可以工作了:)PS.lblDescriptionV实际上是一个文本区域-我在这里的命名约定有点错误…谢谢。有点奇怪,我看到的每个地方都说用这个和那个替换“\n”。但它现在起作用了:)PS.lblDescriptionV实际上是一个文本区域-我在这里的命名约定有点错误。。。