Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > LINE BREAK ISSUE

Reply
Thread Tools

LINE BREAK ISSUE

 
 
Simon Gare
Guest
Posts: n/a
 
      03-17-2007
Hi all,

have a line of code in a ViewLocation.aspx.cs file below

StringBuilder sb = new StringBuilder();
sb.Append("Driver No:
").Append(driver.DriverNo.ToString()).Append("<br> ");
sb.Append("Name: ").Append(driver.FirstName).Append("
").Append(driver.LastName).Append("<br>");
sb.Append("Phone: ").Append(driver.PDAPhoneNumber);

Problem is when it is displayed on the page it shows like this

Driver No: 1<br>Name: Donald Stewart<br>Phone etc etc

Should be

Driver No: 1
Name: Donald Stewart
Phone: 07912 000000 etc etc

Anyone help?

Regards
Simon


--
Simon Gare
The Gare Group Limited

website: www.thegaregroup.co.uk
website: www.privatehiresolutions.co.uk


 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?G=F6ran_Andersson?=
Guest
Posts: n/a
 
      03-17-2007
Simon Gare wrote:
> Hi all,
>
> have a line of code in a ViewLocation.aspx.cs file below
>
> StringBuilder sb = new StringBuilder();
> sb.Append("Driver No:
> ").Append(driver.DriverNo.ToString()).Append("<br> ");
> sb.Append("Name: ").Append(driver.FirstName).Append("
> ").Append(driver.LastName).Append("<br>");
> sb.Append("Phone: ").Append(driver.PDAPhoneNumber);
>
> Problem is when it is displayed on the page it shows like this
>
> Driver No: 1<br>Name: Donald Stewart<br>Phone etc etc
>
> Should be
>
> Driver No: 1
> Name: Donald Stewart
> Phone: 07912 000000 etc etc
>
> Anyone help?


The problem is not in the code that you have shown, but in the code that
you haven't shown. The StringBuilder doesn't show anything on the page,
it only creates a string. It's the way that you display the string on
the page that decides how it's going to show up.

You are using a method that html encodes the string when it's shown on
the page. What you want to do is to use a method that doesn't.

--
Göran Andersson
_____
http://www.guffa.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read a file line by line and write each line to a file based on the5th byte scad C++ 23 05-17-2009 06:11 PM
`if (!p ? i++ : 0) break;' == `if (!p){ i++; break;}' ? lovecreatesbea...@gmail.com C Programming 12 04-14-2008 07:59 AM
How to read a text file line by line and remove some line kaushikshome C++ 4 09-10-2006 10:12 PM
Unnecessary Line Break Issue Sumantra ASP .Net Mobile 0 08-24-2006 12:15 PM
Read a file line by line with a maximum number of characters per line Hugo Java 10 10-18-2004 11:42 AM



Advertisments