ENTER key in TextBox in ASP.NET 2.0

Discussion in 'ASP .Net' started by Benson Wong, Jul 9, 2007.

  1. Benson Wong

    Benson Wong Guest

    I add a TextBox with TextMode="MultiLine" so that I can input multilines to
    the textbox. That's fine.

    When user input <ENTER> as a new line, it is ok during input to the textbox,
    but not ok when the textbox content is saved to database (<ENTER> character
    seems to be ignored, no new line appears when the data is saved to
    database).

    Any hints.
    Benson
    Benson Wong, Jul 9, 2007
    #1
    1. Advertising

  2. Benson Wong

    Patrice Guest

    How do you know ? Newlines could be honored or not depending how you display
    those data. In particular keep in mind that newlines are not significant
    when using HTML i.e. you'll have to replace those with the br tag to see a
    visible effect.

    --
    Patrice

    "Benson Wong" <> a écrit dans le message de
    news: ...
    >I add a TextBox with TextMode="MultiLine" so that I can input multilines to
    >the textbox. That's fine.
    >
    > When user input <ENTER> as a new line, it is ok during input to the
    > textbox, but not ok when the textbox content is saved to database (<ENTER>
    > character seems to be ignored, no new line appears when the data is saved
    > to database).
    >
    > Any hints.
    > Benson
    >
    >
    >
    >
    Patrice, Jul 9, 2007
    #2
    1. Advertising

  3. Benson Wong

    Aidy Guest

    When you show the data on the page replace carriage returns with <br/>

    myText.Replace ("\r\n", "<br/>");

    "Benson Wong" <> wrote in message
    news:...
    >I add a TextBox with TextMode="MultiLine" so that I can input multilines to
    >the textbox. That's fine.
    >
    > When user input <ENTER> as a new line, it is ok during input to the
    > textbox, but not ok when the textbox content is saved to database (<ENTER>
    > character seems to be ignored, no new line appears when the data is saved
    > to database).
    >
    > Any hints.
    > Benson
    >
    >
    >
    >
    >
    Aidy, Jul 9, 2007
    #3
  4. Benson Wong

    David Wier Guest

    or, in VB:
    myText.Replace(vbcrlf, "<br />")

    --
    David Wier
    MVP/ASPInsider
    http://aspnet101.com
    http://iWritePro.com



    "Benson Wong" <> wrote in message
    news:...
    >I add a TextBox with TextMode="MultiLine" so that I can input multilines to
    >the textbox. That's fine.
    >
    > When user input <ENTER> as a new line, it is ok during input to the
    > textbox, but not ok when the textbox content is saved to database (<ENTER>
    > character seems to be ignored, no new line appears when the data is saved
    > to database).
    >
    > Any hints.
    > Benson
    >
    >
    >
    >
    David Wier, Jul 9, 2007
    #4
  5. Benson Wong

    Benson Wong Guest

    Work. Thanks.

    "David Wier" <> ׫Œ‘ì¶à]¼þЄ:...
    > or, in VB:
    > myText.Replace(vbcrlf, "<br />")
    >
    > --
    > David Wier
    > MVP/ASPInsider
    > http://aspnet101.com
    > http://iWritePro.com
    >
    >
    >
    > "Benson Wong" <> wrote in message
    > news:...
    >>I add a TextBox with TextMode="MultiLine" so that I can input multilines
    >>to the textbox. That's fine.
    >>
    >> When user input <ENTER> as a new line, it is ok during input to the
    >> textbox, but not ok when the textbox content is saved to database
    >> (<ENTER> character seems to be ignored, no new line appears when the data
    >> is saved to database).
    >>
    >> Any hints.
    >> Benson
    >>
    >>
    >>
    >>

    >
    >
    Benson Wong, Jul 10, 2007
    #5
    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. PD
    Replies:
    5
    Views:
    14,491
    Hermit Dave
    Sep 2, 2004
  2. BrianDH

    Enter Key H*ll, control enter key submit button

    BrianDH, Jan 12, 2005, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    369
    Anders Matthiessen
    Jan 12, 2005
  3. M P
    Replies:
    1
    Views:
    452
  4. Matt
    Replies:
    1
    Views:
    493
    Michael Winter
    Mar 6, 2004
  5. HopfZ
    Replies:
    0
    Views:
    536
    HopfZ
    Aug 28, 2006
Loading...

Share This Page