Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / May 2008

Tip: Looking for answers? Try searching our database.

Carriage Return in Web.config file?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Waldy - 30 May 2008 09:33 GMT
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?
Mark Rae [MVP] - 30 May 2008 10:10 GMT
> 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?

<br />

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Waldy - 30 May 2008 10:26 GMT
<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.
Segundo Serrano - 30 May 2008 10:38 GMT
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

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

 "Mark Rae [MVP]" <mark@markNOSPAMrae.net> wrote in message
 news:OpHPLUjwIHA.3780@TK2MSFTNGP03.phx.gbl...
  <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.
rogers.terry@gmail.com - 30 May 2008 10:48 GMT
> 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.
Waldy - 30 May 2008 10:46 GMT
> <br />

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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.