Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old July 31st, 2006, 03:06 PM
Authorized User
 
Join Date: Nov 2003
Location: Phoenix, AZ, USA.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default display carriage returns in label

I have kind of a multi page form, where on the first page there is a multi-line textarea. This allows you to enter multiple lines in the textarea with carriage returns. On the second page I am displaying the information that was typed into the textarea using a label. The problem is that there are no longer carriage returns so the text all flows together. How do I get the presentation to display in the format in which it was typed with the carriage returns?

FYI - I'm using all server controls. Here are the actual controls:

<asp:TextBox ID="Details1" runat="server" Rows="5" TextMode="MultiLine" Width="100%" CssClass="normal" Height="65px" Wrap="True"></asp:TextBox>

<asp:Label ID="lblDetails1" runat="server" Width="100%" CssClass="normal" Height="65px"></asp:Label>

Thanks,
Bob

Reply With Quote
  #2 (permalink)  
Old July 31st, 2006, 09:37 PM
Authorized User
 
Join Date: Nov 2003
Location: Phoenix, AZ, USA.
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nevermind, I figured it out:

newString = oldString.Replace("\n", "<br />");

Thanks,
Bob

Reply With Quote
  #3 (permalink)  
Old May 21st, 2011, 09:19 AM
Authorized User
Points: 445, Level: 7
Points: 445, Level: 7 Points: 445, Level: 7 Points: 445, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2011
Posts: 89
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I'm having this problem but cant seem to fix it:

Dim NewsFile As String = Server.MapPath("~/App_Data/MemberNews.txt")

Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim _NewsFile As String = NewsFile.Replace(Chr(13), "<br>")
lblMemberNews.Text = File.ReadAllText(_NewsFile)
End Sub

The label still formats it on the same line, have tired with "/n" but doesnt work...
Reply With Quote
  #4 (permalink)  
Old May 21st, 2011, 09:50 AM
Imar's Avatar
Wrox Author
Points: 67,581, Level: 100
Points: 67,581, Level: 100 Points: 67,581, Level: 100 Points: 67,581, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,269
Thanks: 66
Thanked 1,428 Times in 1,408 Posts
Default

You're replacing in the file name, but I think you want to replace in the results of ReadAllText instead?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #5 (permalink)  
Old May 21st, 2011, 01:10 PM
Authorized User
Points: 445, Level: 7
Points: 445, Level: 7 Points: 445, Level: 7 Points: 445, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2011
Posts: 89
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Ah cheers, just wasnt in the right place, I thought I tried everywhere but obviously not after ReadAllText()...
Reply With Quote
Reply


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
for-each carriage returns TiLaser XSLT 4 April 28th, 2008 08:31 PM
SubTotal() to display in a label JayLou BOOK: Wrox's ASP.NET 2.0 Visual Web Developer 2005 Express Edition Starter ISBN: 978-0-7645-8807-5 1 April 11th, 2007 11:18 AM
How are Carriage Returns stored? SQLScott SQL Server 2005 2 December 1st, 2006 04:07 PM
How are Carriage Returns stored? SQLScott SQL Server 2000 3 November 24th, 2006 10:37 AM
Display Label in Arabic shashikumar Visual Studio 2005 1 August 4th, 2006 06:10 AM



All times are GMT -4. The time now is 08:10 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.