I have a table column that has multiple lines (\r\n) and html tags in it. I
want to display it in a div and label that html tags can be seen and
newlines should work.
If i use div.innerHTML newlines are lost and html tags doesn't show.
If i use div.innerHTML with replace(Environment.NewLine,"<br>") breaks works
but html tags doesn't show.
If i use div.innerText again newlines and html tags are lost.
What can i do?
ThanksVersus,
The bottom line is that "\r\n" means nothing in HTML - you have to change it
to "<br/>" -- which means you need to pre-process your string with
..Replace("\r\n", "<br/>");
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
"versus" wrote:
Quote:
Originally Posted by
Hi
>
I have a table column that has multiple lines (\r\n) and html tags in it. I
want to display it in a div and label that html tags can be seen and
newlines should work.
If i use div.innerHTML newlines are lost and html tags doesn't show.
If i use div.innerHTML with replace(Environment.NewLine,"<br>") breaks works
but html tags doesn't show.
If i use div.innerText again newlines and html tags are lost.
>
What can i do?
>
Thanks
>
>
>
Thanks for answering. Replace(Environment.NewLine,"<br>") already works for
that problem. But i cannot see html tags as regular text. I want them to be
displayed not parsed with htmlparser.
Let me explain again. I have an sql db table with columns that has both
environment.newline(\r\n) and html tags. I want newlines to break lines and
html tags to be displayed at the same time.
"Peter Bromberg [C# MVP]" <pbromberg@.yahoo.yohohhoandabottleofrum.comwrote
in message news:4CA1F3DF-BB2B-479B-8025-69154C4984C5@.microsoft.com...
Quote:
Originally Posted by
Versus,
The bottom line is that "\r\n" means nothing in HTML - you have to change
it
to "<br/>" -- which means you need to pre-process your string with
.Replace("\r\n", "<br/>");
>
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
>
>
>
"versus" wrote:
>
Quote:
Originally Posted by
>Hi
>>
>I have a table column that has multiple lines (\r\n) and html tags in it.
>I
>want to display it in a div and label that html tags can be seen and
>newlines should work.
>If i use div.innerHTML newlines are lost and html tags doesn't show.
>If i use div.innerHTML with replace(Environment.NewLine,"<br>") breaks
>works
>but html tags doesn't show.
>If i use div.innerText again newlines and html tags are lost.
>>
>What can i do?
>>
>Thanks
>>
>>
>>
"versus" <tencere@.dibin.karawrote in message
news:ee99xTJGIHA.4808@.TK2MSFTNGP05.phx.gbl...
Quote:
Originally Posted by
Thanks for answering. Replace(Environment.NewLine,"<br>") already works
for that problem. But i cannot see html tags as regular text. I want them
to be displayed not parsed with htmlparser.
>
Let me explain again. I have an sql db table with columns that has both
environment.newline(\r\n) and html tags. I want newlines to break lines
and html tags to be displayed at the same time.
>
"Peter Bromberg [C# MVP]" <pbromberg@.yahoo.yohohhoandabottleofrum.com>
wrote in message
news:4CA1F3DF-BB2B-479B-8025-69154C4984C5@.microsoft.com...
Quote:
Originally Posted by
>Versus,
>The bottom line is that "\r\n" means nothing in HTML - you have to change
>it
>to "<br/>" -- which means you need to pre-process your string with
>.Replace("\r\n", "<br/>");
>>
>-- Peter
>Recursion: see Recursion
>site: http://www.eggheadcafe.com
>unBlog: http://petesbloggerama.blogspot.com
>BlogMetaFinder: http://www.blogmetafinder.com
>>
>>
>>
>"versus" wrote:
>>
Quote:
Originally Posted by
>>Hi
>>>
>>I have a table column that has multiple lines (\r\n) and html tags in
>>it. I
>>want to display it in a div and label that html tags can be seen and
>>newlines should work.
>>If i use div.innerHTML newlines are lost and html tags doesn't show.
>>If i use div.innerHTML with replace(Environment.NewLine,"<br>") breaks
>>works
>>but html tags doesn't show.
>>If i use div.innerText again newlines and html tags are lost.
>>>
>>What can i do?
>>>
>>Thanks
>>>
>>>
>>>
>
>
I think if you use the <pretag to wrap your code it will honor the CRLF
and show the tags as if they are text within the <pre></pretags.
Hope this helps
LS
I think if you use the <pretag to wrap your code it will honor the CRLF
Quote:
Originally Posted by
and show the tags as if they are text within the <pre></pretags.
>
Hope this helps
LS
Thanks but his solution removes css classes and when i use checkbox with
label, label click doesn't work.
On Sat, 27 Oct 2007 04:55:00 -0700, Peter Bromberg [C# MVP]
<pbromberg@.yahoo.yohohhoandabottleofrum.comwrote:
Quote:
Originally Posted by
>Versus,
>The bottom line is that "\r\n" means nothing in HTML - you have to change it
>to "<br/>" -- which means you need to pre-process your string with
>.Replace("\r\n", "<br/>");
>
>-- Peter
>Recursion: see Recursion
>site: http://www.eggheadcafe.com
>unBlog: http://petesbloggerama.blogspot.com
>BlogMetaFinder: http://www.blogmetafinder.com
Actually, newlines may make a lot of sense when you want your HTML to
be easily understood if you do a view source on the html page ...
--
http://bytes.thinkersroom.com
On 27 okt, 14:54, "Lloyd Sheen" <a...@.b.cwrote:
Quote:
Originally Posted by
"versus" <tenc...@.dibin.karawrote in message
>
news:ee99xTJGIHA.4808@.TK2MSFTNGP05.phx.gbl...
>
Quote:
Originally Posted by
Thanks for answering. Replace(Environment.NewLine,"<br>") already works
for that problem. But i cannot see html tags as regular text. I want them
to be displayed not parsed with htmlparser.
>
Quote:
Originally Posted by
Let me explain again. I have an sql db table with columns that has both
environment.newline(\r\n) and html tags. I want newlines to break lines
and html tags to be displayed at the same time.
>
Quote:
Originally Posted by
"Peter Bromberg [C# MVP]" <pbromb...@.yahoo.yohohhoandabottleofrum.com>
wrote in message
news:4CA1F3DF-BB2B-479B-8025-69154C4984C5@.microsoft.com...
Quote:
Originally Posted by
Versus,
The bottom line is that "\r\n" means nothing in HTML - you have to change
it
to "<br/>" -- which means you need to pre-process your string with
.Replace("\r\n", "<br/>");
>
Quote:
Originally Posted by
Quote:
Originally Posted by
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
>
Quote:
Originally Posted by
Quote:
Originally Posted by
"versus" wrote:
>
Quote:
Originally Posted by
Quote:
Originally Posted by
>Hi
>
Quote:
Originally Posted by
Quote:
Originally Posted by
>I have a table column that has multiple lines (\r\n) and html tags in
>it. I
>want to display it in a div and label that html tags can be seen and
>newlines should work.
>If i use div.innerHTML newlines are lost and html tags doesn't show.
>If i use div.innerHTML with replace(Environment.NewLine,"<br>") breaks
>works
>but html tags doesn't show.
>If i use div.innerText again newlines and html tags are lost.
>
Quote:
Originally Posted by
Quote:
Originally Posted by
>What can i do?
>
Quote:
Originally Posted by
Quote:
Originally Posted by
>Thanks
>
I think if you use the <pretag to wrap your code it will honor the CRLF
and show the tags as if they are text within the <pre></pretags.
>
Hope this helps
LS
That's correct but the problem lies elsewhere.
If you update a <pretag with innerHTML, Internet Explorer will
remove the \n's before it's in the <pretag.
0 comments:
Post a Comment