Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   Force multi line field value to output with line breaks? (http://www.velocityreviews.com/forums/t777701-force-multi-line-field-value-to-output-with-line-breaks.html)

bernadou 01-22-2006 04:48 PM

Force multi line field value to output with line breaks?
 
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

Phillip Williams 01-22-2006 08:50 PM

RE: Force multi line field value to output with line breaks?
 
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


bernadou 01-23-2006 01:23 PM

RE: Force multi line field value to output with line breaks?
 
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



All times are GMT. The time now is 07:58 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.