How do convert text to HTML?

Discussion in 'ASP .Net' started by BADEV, Dec 10, 2003.

  1. BADEV

    BADEV Guest

    I've an multi-line edit box on an html page that I use to
    collect detailed description information. I'd also like
    to display that information on an html page... How do I
    convert it to hmtl so that line feeds and other special
    characters are displayed properly.
     
    BADEV, Dec 10, 2003
    #1
    1. Advertising

  2. Checkout the System.Web.HttpServerUtility.HTMLEncode function ...

    eg, Label1.Text = HTMLEncode( Textbox1.Text )

    Alex Papadimoulis
    "BADEV" <> wrote in message
    news:1143f01c3bf5c$6ca9a720$...
    > I've an multi-line edit box on an html page that I use to
    > collect detailed description information. I'd also like
    > to display that information on an html page... How do I
    > convert it to hmtl so that line feeds and other special
    > characters are displayed properly.
     
    Alex Papadimoulis, Dec 10, 2003
    #2
    1. Advertising

  3. BADEV

    Guest Guest

    I'm doing that already but that doesn't do the trick.
    somehow cr/lf has to be converted to <BR> etc. and
    htmlencode is not doing that.
    >-----Original Message-----
    >Checkout the System.Web.HttpServerUtility.HTMLEncode

    function ...
    >
    >eg, Label1.Text = HTMLEncode( Textbox1.Text )
    >
    >Alex Papadimoulis
    >"BADEV" <> wrote in

    message
    >news:1143f01c3bf5c$6ca9a720$...
    >> I've an multi-line edit box on an html page that I use

    to
    >> collect detailed description information. I'd also

    like
    >> to display that information on an html page... How do I
    >> convert it to hmtl so that line feeds and other special
    >> characters are displayed properly.

    >
    >
    >.
    >
     
    Guest, Dec 10, 2003
    #3
  4. BADEV

    mikeb Guest

    BADEV wrote:
    > I've an multi-line edit box on an html page that I use to
    > collect detailed description information. I'd also like
    > to display that information on an html page... How do I
    > convert it to hmtl so that line feeds and other special
    > characters are displayed properly.


    HttpUtility.HtmlEncode() will make it so special characters are
    displayed properly.

    Then try wrapping the text in <pre> </pre> tags. That will preserve line
    breaks. If you don't like the text appearance used for the <pre>
    element, you can use style sheets to change it, or perform a search and
    replace to change line breaks (\n, \r\n, or whatever you decide is a
    line break) to the "<br/>" tag.

    --
    mikeb
     
    mikeb, Dec 10, 2003
    #4
  5. BADEV

    Guest Guest

    Thanks, that did the trick. I just have to fix the
    styles now :) but that's an simpler problem.
    >-----Original Message-----
    >BADEV wrote:
    >> I've an multi-line edit box on an html page that I use

    to
    >> collect detailed description information. I'd also

    like
    >> to display that information on an html page... How do

    I
    >> convert it to hmtl so that line feeds and other

    special
    >> characters are displayed properly.

    >
    >HttpUtility.HtmlEncode() will make it so special

    characters are
    >displayed properly.
    >
    >Then try wrapping the text in <pre> </pre> tags. That

    will preserve line
    >breaks. If you don't like the text appearance used for

    the <pre>
    >element, you can use style sheets to change it, or

    perform a search and
    >replace to change line breaks (\n, \r\n, or whatever you

    decide is a
    >line break) to the "<br/>" tag.
    >
    >--
    >mikeb
    >.
    >
     
    Guest, Dec 10, 2003
    #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. zalbermere

    Convert text to HTML

    zalbermere, Aug 20, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    357
    Manohar Kamath [MVP]
    Aug 20, 2003
  2. Replies:
    4
    Views:
    647
    Mark Rae
    Jan 17, 2006
  3. geoffbache
    Replies:
    8
    Views:
    709
    Stefan Behnel
    Feb 11, 2008
  4. keal
    Replies:
    3
    Views:
    182
    Robert Klemme
    Jan 4, 2006
  5. Replies:
    2
    Views:
    195
    John Bokma
    Aug 30, 2013
Loading...

Share This Page