473,499 Members | 1,672 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do convert text to HTML?

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.
Nov 18 '05 #1
4 2278
Checkout the System.Web.HttpServerUtility.HTMLEncode function ...

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

Alex Papadimoulis
"BADEV" <an*******@discussions.microsoft.com> wrote in message
news:11*****************************@phx.gbl...
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.

Nov 18 '05 #2
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" <an*******@discussions.microsoft.com> wrote in messagenews:11*****************************@phx.gbl...
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.

.

Nov 18 '05 #3
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
Nov 18 '05 #4
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 aredisplayed properly.

Then try wrapping the text in <pre> </pre> tags. That will preserve linebreaks. 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 andreplace to change line breaks (\n, \r\n, or whatever you decide is aline break) to the "<br/>" tag.

--
mikeb
.

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
19218
by: Erwin Bormans | last post by:
Hello I want to convert a value in a text propertie to a double. I can use CDbl(grid1.text) for this, but the problem is that some text properties are empty and when they are the code give...
2
8640
by: Khurram | last post by:
how do i convert this HTML into CSS <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link rel=stylesheet HREF="styles.css" type=text/css...
4
7001
by: Dominic | last post by:
Hi guys, In .NET, how can I convert a HTML file to TIFF efficiently? One possible way is that I can first use word automatation to load the HTML up and then print it to TIFF. Is that right?...
4
3568
by: Daniel Köster | last post by:
Is there someone who has got some tips on how to convert text encoded with character referense ({) to unicode or uft-8 format using VB.net? Is there a function or something that can help with the...
9
5339
by: Arash Dejkam | last post by:
Hi All, Is it possible to write on an <OBJECT type="text/html"> using document.write() from within the html containing that tag the way we write on a popup window? I couldn't do that after a lot...
2
2241
by: Sugapablo | last post by:
Are there any free/open source ASP solutions that will allow you to dynamically convert an HTML page to a PDF? What I'd like to do is include a "Convert to PDF" button on a .asp page that will...
4
3095
by: elsigh | last post by:
I'm wondering if anyone has any ideas about a way to quickly convert an HTML DOM Node into an XML Document. The goal is that I want to perform XSLT on the Node, which is coded correctly as XHTML....
13
31353
by: =?Utf-8?B?S2VzdGZpZWxk?= | last post by:
Hi Our company has a .Net web service that, when called via asp.net web pages across our network works 100%! The problem is that when we try and call the web service from a remote machine, one...
1
3781
by: rajendiran | last post by:
hi friends i will type any text in textbox. and chose any language that text will converted in that language example like english to french.. how to convert text like this anyone help me..........
14
1812
by: Stanimir Stamenkov | last post by:
I've found some contradiction I want to resolve. <http://www.w3.org/MarkUp/2004/xhtml-faq#mime11states: I've noted "_disallowed_ text/html" and "_must_ be sent with an XML-related media...
0
7131
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7007
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6894
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7388
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5470
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4600
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3099
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3091
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.