Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 31st, 2006, 02:06 PM
Authorized User
 
Join Date: Nov 2003
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

 
Old July 31st, 2006, 08:37 PM
Authorized User
 
Join Date: Nov 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nevermind, I figured it out:

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

Thanks,
Bob

 
Old May 21st, 2011, 08:19 AM
Authorized User
 
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...
 
Old May 21st, 2011, 08:50 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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!
 
Old May 21st, 2011, 12:10 PM
Authorized User
 
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()...





Similar Threads
Thread Thread Starter Forum Replies Last Post
for-each carriage returns TiLaser XSLT 4 April 28th, 2008 07: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 10: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 05:10 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.