Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Force multi line field value to output with line breaks?

Reply
Thread Tools

Force multi line field value to output with line breaks?

 
 
bernadou
Guest
Posts: n/a
 
      01-22-2006
I have a field value that might look like this in the db
First Line
Second Line
Third Line

When I query the data and output that data to a label in my gridveiw it
looks like this:
First Line Second Line Third Line

How to I insert HTML formatting into the label text so it will render in the
same fashion it was entered in the db?

Or in other words, render with "<BR>" tags in place of the line breaks in
the data?

Thanks!
B
 
Reply With Quote
 
 
 
 
Phillip Williams
Guest
Posts: n/a
 
      01-22-2006
Hello again Bernie,

You can use Environment.NewLine with the Replace method like this:

<asp:label runat="Server" ID="lblNotes" Text='<%#
Eval("fldNodes").ToString().Replace(Environment.Ne wLine, "<br>")
%>'></asp:label>
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


"bernadou" wrote:

> I have a field value that might look like this in the db
> First Line
> Second Line
> Third Line
>
> When I query the data and output that data to a label in my gridveiw it
> looks like this:
> First Line Second Line Third Line
>
> How to I insert HTML formatting into the label text so it will render in the
> same fashion it was entered in the db?
>
> Or in other words, render with "<BR>" tags in place of the line breaks in
> the data?
>
> Thanks!
> B

 
Reply With Quote
 
 
 
 
bernadou
Guest
Posts: n/a
 
      01-23-2006
Phillip,
Once again you nailed it. I"ll give this a shot. Much appreciated.

"Phillip Williams" wrote:

> Hello again Bernie,
>
> You can use Environment.NewLine with the Replace method like this:
>
> <asp:label runat="Server" ID="lblNotes" Text='<%#
> Eval("fldNodes").ToString().Replace(Environment.Ne wLine, "<br>")
> %>'></asp:label>
> --
> HTH,
> Phillip Williams
> http://www.societopia.net
> http://www.webswapp.com
>
>
> "bernadou" wrote:
>
> > I have a field value that might look like this in the db
> > First Line
> > Second Line
> > Third Line
> >
> > When I query the data and output that data to a label in my gridveiw it
> > looks like this:
> > First Line Second Line Third Line
> >
> > How to I insert HTML formatting into the label text so it will render in the
> > same fashion it was entered in the db?
> >
> > Or in other words, render with "<BR>" tags in place of the line breaks in
> > the data?
> >
> > Thanks!
> > B

 
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
Nike air force one, air force 1, air force one low cut, air force one abdul_razak@indiatimes.com Digital Photography 2 12-31-2008 04:29 PM
Nike Air Force Ones,Air Force One Air Force One-1 lky52193@gmail.com Computer Support 0 01-17-2008 04:40 PM
Nike Air Force Ones,Air Force One Air Force One-1,25th anniversary lky52112@gmail.com Digital Photography 0 01-15-2008 04:46 PM
Nike Air Force Ones,Air Force One Air Force One-1,25th anniversary lky52112@gmail.com Digital Photography 0 01-15-2008 04:34 PM



Advertisments