Carriage Return in Web.config file?

W

Waldy

Hi there,
I am reading a string from a web.config file and displaying
it in a label on an .ASPX page. I want a carriage return in the string so
that it looks right, but can't get it to put one in.. I have tried using \n
and
e.t.c. in the config file setting but none of those produce a
carraige return in the output. Is this possible?
 
W

Waldy

<br />

Hi Mark,
I've tried that, but it doesn't work. It crashes the
application if you just enter <br/> in the web.config file and if you escape
the less than / greater than characters, it just comes out as <br/> in the
text.
 
S

Segundo Serrano

Hi,

<appSettings>
<add key="XXX" value="XXX-zzzz" />

</appSettings>

-------------------------------------------------------------------

Label1.Text = ConfigurationManager.AppSettings("XXX").Replace("-", "<br />")

HTH,

S. Serrano P.
Sistemas
JABSOFT
blog: http://dotnet-peru.blogspot.com
511-91974972
511-2428802


--------------------------------------------------------------------------------


"Waldy" <[email protected]> escribió en el mensaje <br />

Hi Mark,
I've tried that, but it doesn't work. It crashes the
application if you just enter <br/> in the web.config file and if you escape
the less than / greater than characters, it just comes out as <br/> in the
text.
 
W

Waldy

Mark Rae said:

Mark,
you were right. I realised that I was using a span directly
rather than an asp:label to render a span. If you set the label text it
does process the <br> and render a new line.
 
R

rogers.terry

Hi Mark,
I've tried that, but it doesn't work. It crashes the
application if you just enter <br/> in the web.config file and if you escape
the less than / greater than characters, it just comes out as <br/> in the
text.

Try a Literal instead of a Label.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top