Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Line feed in DB field

Reply
Thread Tools

Line feed in DB field

 
 
Frank Esser
Guest
Posts: n/a
 
      04-14-2005
Hello,

I read data from a DB field where a line feed ("\n") is in.
I put this data as text to a label web control.
In the HTML page the line feeds are shown as real line feeds in the HTML
source.
But in the label itself on the page in the browser the line feeds are
ignored.

How can I change the line feeds to HTML syntax (<br/>)?

This does not work:
Server.HtmlEncode(text)






 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      04-14-2005
You'll need to use String.Replace("\n", "<br/>")

-Brock
DevelopMentor
http://staff.develop.com/ballen



> Hello,
>
> I read data from a DB field where a line feed ("\n") is in.
> I put this data as text to a label web control.
> In the HTML page the line feeds are shown as real line feeds in the
> HTML
> source.
> But in the label itself on the page in the browser the line feeds are
> ignored.
> How can I change the line feeds to HTML syntax (<br/>)?
>
> This does not work:
> Server.HtmlEncode(text)




 
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
javascript validation for a not required field, field is onlyrequired if another field has a value jr Javascript 3 07-08-2010 10:33 AM
Feed another field (or pop-up a choice) in JSP when a field isentered a certain value Sébastien de Mapias Java 5 05-26-2009 08:35 PM
How do you get feed discovery to work? I go to web pages I know has feeds, but the feed discovery button is disabled. Help! Tim Bryant Computer Support 1 02-13-2007 05:01 AM
1.Enter space bar for field names and save the field.The field shoud not get saved and an alert should be there as"Space bars are not allowed" Sound Javascript 2 09-28-2006 02:43 PM
How to create carriage return or line feed or new line Dave Tichenor ASP .Net 3 02-17-2004 01:55 AM



Advertisments