Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to put a HTML paragraph on a WebForm

Reply
Thread Tools

How to put a HTML paragraph on a WebForm

 
 
ad
Guest
Posts: n/a
 
      02-23-2006
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?


 
Reply With Quote
 
 
 
 
Darren Kopp
Guest
Posts: n/a
 
      02-23-2006
Literal Control.

HTH,
Darren Kopp
http://blog.secudocs.com/

 
Reply With Quote
 
 
 
 
ad
Guest
Posts: n/a
 
      02-23-2006
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" <(E-Mail Removed)>
???????:(E-Mail Removed) groups.com...
> Literal Control.
>
> HTH,
> Darren Kopp
> http://blog.secudocs.com/
>



 
Reply With Quote
 
Hans Kesting
Guest
Posts: n/a
 
      02-23-2006
> 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


 
Reply With Quote
 
UT-BadBoy
Guest
Posts: n/a
 
      02-23-2006
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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why choose a paragraph element for a paragraph? dorayme HTML 112 03-30-2009 10:56 PM
striping HTML tags from string, but leaving paragraph formatting Kevin Blount ASP General 2 12-06-2005 09:49 PM
HTML Paragraph question MW de Jager ASP .Net 9 07-06-2005 02:02 PM
no code in webform using vs.net, but in webform using notepad timmso ASP .Net 1 12-12-2003 04:30 PM
Including WebForm Image Control in a Webform Table Control titof ASP .Net 0 07-24-2003 01:01 PM



Advertisments