简体   繁体   English

在Crystal Report上将多行文本框值显示为多行文本

[英]Display mulitline textbox value as multiline text on Crystal Report

I am saving value from a Multiline ASP.Net Textbox into the Database . 我正在将Multiline ASP.Net Textbox值保存到Database

<asp:TextBox id="txtDesc" runat="server" TextMode="MultiLine" width="300"></asp:TextBox>

It save the lines from Textbox separted by a Space in the database. 它将Textbox由空格分隔的行保存在数据库中。

I want to display this value on the Crystal Reports exactly the same as entered in Textbox ie multiline value. 我想在Crystal Reports上显示与在Textbox输入的值完全相同的值,即多行值。 Currently, it displays Textbox value in a single line on reports. 当前,它在报告的一行中显示“ Textbox值。

For understanding purpose : 出于理解目的:

Why multiline TextBox doesn't save any <br/> or /n with text in Database ? 为什么多行TextBox在数据库中不保存任何<br/>/n文本?

OR 要么

When getting back the value, how it differentiate different lines in a value (mulitline value) 取回值时,如何区分值中的不同行 (mulitline值)

Any help will be appreciated. 任何帮助将不胜感激。

From the following post: html textarea injecting line breaks , where the opposite problem was mentioned, you can use the wrap="hard" attribute to replace soft line breaks with hard ones in the TextBox: 在以下文章中: html textarea注入换行符 ,提到了相反的问题,您可以使用wrap="hard"属性在TextBox中用硬换行符替换硬换行符:

void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        txtDesc.Attributes.Add("wrap", "hard");
        ....
    }
}

On my Windows system, \\r\\n is inserted between lines. 在我的Windows系统上, \\r\\n插入行之间。

According to my tests, the wrap attribute is maintained accross postbacks. 根据我的测试, wrap属性在回发期间保持不变。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM