How to put a HTML paragraph on a WebForm

Discussion in 'ASP .Net' started by ad, Feb 23, 2006.

  1. ad

    ad Guest

    I want to put a HTML paragraph on a WebForm in program.
    There are HTML tags in the paragraph, I hope the paragraph can render as
    normal HTML page.

    Which control can I use to place the HTML paragraph?
    ad, Feb 23, 2006
    #1
    1. Advertising

  2. ad

    Darren Kopp Guest

    Darren Kopp, Feb 23, 2006
    #2
    1. Advertising

  3. ad

    ad Guest

    Thanks,
    The lines of my HTML paragraph is over 300 lines.
    But I found the Literal Control can only acept one line.
    How can I put the 300 lines HTML paragraph into a Literal Control ?


    "Darren Kopp" <>
    ???????:...
    > Literal Control.
    >
    > HTH,
    > Darren Kopp
    > http://blog.secudocs.com/
    >
    ad, Feb 23, 2006
    #3
  4. ad

    Hans Kesting Guest

    Re: =?UTF-8?B?SG93IHRvIHB1dCBhIEhUTUwgcGFyYWdyYXBoIG9uIGEgV2ViRm9y?==?UTF-8?B?bQ==?=

    > Thanks,
    > The lines of my HTML paragraph is over 300 lines.
    > But I found the Literal Control can only acept one line.
    > How can I put the 300 lines HTML paragraph into a Literal Control ?
    >


    You don't add the text line-by-line, but first you collect all lines
    and THEN assign that (single) string to the .Text property of that
    Literal.

    string s = "line 1<br>";
    s = s + "line 2<br>";
    myLit.Text = s;


    Note: you will need <br>'s to signal the end-of-line, as this text is
    "literal html text", meaning that no translation will be done.

    Note 2: if you are adding lots of little strings to build the final
    result, you might want to consider using StringBuilder

    Hans Kesting
    Hans Kesting, Feb 23, 2006
    #4
  5. ad

    UT-BadBoy Guest

    If your text already contains the endline markers ("\n"), use the
    string.replace to replace the "\\n" with the "<br>"

    if text is the input(the 300 lines of text with the endline markers)
    then

    Literal lit = new Liter();
    lit.Text = input.Replace("\\n", "<br>");

    this should return a HTML friendly text separated into lines.

    Kevin
    UT-BadBoy, Feb 23, 2006
    #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. titof
    Replies:
    0
    Views:
    494
    titof
    Jul 24, 2003
  2. timmso
    Replies:
    1
    Views:
    477
    Alex Papadimoulis
    Dec 12, 2003
  3. MW de Jager

    HTML Paragraph question

    MW de Jager, Jul 6, 2005, in forum: ASP .Net
    Replies:
    9
    Views:
    464
    John Timney \(ASP.NET MVP\)
    Jul 6, 2005
  4. dorayme
    Replies:
    112
    Views:
    2,715
    dorayme
    Mar 30, 2009
  5. Kevin Blount
    Replies:
    2
    Views:
    125
    Kevin Blount
    Dec 6, 2005
Loading...

Share This Page