views:

1212

answers:

2

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

" test with whitespace "

whitespaces within single quotes are not displayed.

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

+2  A: 
rp
+1  A: 

Could it be that you try to get a space before and after your text to get some spacing between the border of the table cell and your text?

If so you should have a look at the CSS style "padding" or padding-left, padding-right. This will add space between the tables border and your text.

Add this to your page:

<style type="text/css">
td {
padding: 4px;
}
</style>

If this is not what you are after, I apologize.

PeterTheNiceGuy