Multiline textbox drop the char return when saved to sql

Discussion in 'ASP .Net' started by CalSun, Aug 24, 2005.

  1. CalSun

    CalSun Guest

    Hi all,
    I try to save a multiline textbox into an sql field (nvarchar(1024)). As I
    read it out and display, the text drops all the linefeed char.
    Is there a way to cure this? Thank you all for help.

    --Calsun
     
    CalSun, Aug 24, 2005
    #1
    1. Advertising

  2. CalSun

    Guest

    1. Advertising

  3. CalSun

    CalSun Guest

    CalSun, Aug 24, 2005
    #3
  4. When you render the content, it renders it as HTML text. The problem is
    that the browser ignores whitespace. Before rendering it, you will need to
    change all linefeeds to <br>.

    "CalSun" <> wrote in message
    news:%...
    > Hi all,
    > I try to save a multiline textbox into an sql field (nvarchar(1024)). As I
    > read it out and display, the text drops all the linefeed char.
    > Is there a way to cure this? Thank you all for help.
    >
    > --Calsun
    >
     
    Peter Rilling, Aug 24, 2005
    #4
  5. CalSun

    CalSun Guest

    Thanks Peter,
    I'll try that.
    By the way, what is the value of the linefeed char inside a multiline
    textbox?
    thanks
    --CS
    "Peter Rilling" <> wrote in message
    news:%...
    > When you render the content, it renders it as HTML text. The problem is
    > that the browser ignores whitespace. Before rendering it, you will need
    > to change all linefeeds to <br>.
    >
    > "CalSun" <> wrote in message
    > news:%...
    >> Hi all,
    >> I try to save a multiline textbox into an sql field (nvarchar(1024)). As
    >> I read it out and display, the text drops all the linefeed char.
    >> Is there a way to cure this? Thank you all for help.
    >>
    >> --Calsun
    >>

    >
    >
     
    CalSun, Aug 24, 2005
    #5
  6. CalSun

    CalSun Guest

    Thank you all for helping.
    I just converted ctrlf into <br> before saving. That works fine. However, it
    won't look good if I query and display the text in a non-html environment.
    --CS

    "CalSun" <> wrote in message
    news:%...
    > Hi all,
    > I try to save a multiline textbox into an sql field (nvarchar(1024)). As I
    > read it out and display, the text drops all the linefeed char.
    > Is there a way to cure this? Thank you all for help.
    >
    > --Calsun
    >
     
    CalSun, Aug 25, 2005
    #6
  7. When rendering in non-html just use the following concept to deal with the BR
    tags:

    // C# Code
    string x = "some text<br>some more text<br>blah blah blah";
    x = x.Replace("<br>", "\r\n");

    ' VB Code
    Dim x as string = "some text<br>some more text<br>blah blah blah"
    x = x.Replace("<br>", vbCrLf)



    "CalSun" wrote:

    > Thank you all for helping.
    > I just converted ctrlf into <br> before saving. That works fine. However, it
    > won't look good if I query and display the text in a non-html environment.
    > --CS
    >
    > "CalSun" <> wrote in message
    > news:%...
    > > Hi all,
    > > I try to save a multiline textbox into an sql field (nvarchar(1024)). As I
    > > read it out and display, the text drops all the linefeed char.
    > > Is there a way to cure this? Thank you all for help.
    > >
    > > --Calsun
    > >

    >
    >
    >
     
    =?Utf-8?B?Rm9vbGV5Q29vbGV5MTM=?=, Aug 27, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Middlemiss
    Replies:
    2
    Views:
    5,260
    Jacob Yang [MSFT]
    Nov 10, 2003
  2. lovecreatesbeauty
    Replies:
    1
    Views:
    1,124
    Ian Collins
    May 9, 2006
  3. =?Utf-8?B?cGVsZWdrMQ==?=

    asp.net 2 drop down list and a selected saved value

    =?Utf-8?B?cGVsZWdrMQ==?=, Jul 11, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    468
    =?Utf-8?B?cGVsZWdrMQ==?=
    Jul 11, 2007
  4. Zero
    Replies:
    1
    Views:
    255
  5. dale zhang
    Replies:
    8
    Views:
    449
    Tintin
    Nov 30, 2004
Loading...

Share This Page