Display string with whitespace in ASP.NET?

I need to display a string which has a white space on a asp.net page.

*Here is what I am doing:*

cell = New TableCell

cell.Text = value  (lets assume value is <"  test with whitespace    ">

row.Cells.Add(cell)

and it gets rendered as

<tr>
<td>"  test with whitespace    "</td>
</tr>

whitespaces within single quotes are not displayed.

I want this value to be displayed as it is on my page.

Answers


HTML strips out all but one space character. You need to use the &NBSP; entity to ensure white space is presented with HTML. Use the String class's Replace method (or RegEx) to swap out each space for &NBSP;

http://en.wikipedia.org/wiki/Non-breaking_space


Need Your Help

Why doesn't CSS have the ability for elements to preserve width:height ratio

css syntax scaling

So, this is perhaps foolish, but it seems to me that CSS would benefit from the ability to do something similar to the following:

Additional persistence layer in roo

persistence spring-roo

I have created a roo project following the typical persistence setup instructions resulting in a Hibernate and Hypersonic in-memory data layer. I was wondering how it's possible to add another, say

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.