LINE BREAK ISSUE

S

Simon Gare

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
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

Simon said:
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.
 

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,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top