Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

  in asp.net server side code?

Tags:

c#

asp.net

I have this code :

string s = "royi";
string val = "5";

I also have a label <asp:Label ..../>

I want to create s+" "+val

but I want That the " " will be &nbsp;

How can I do it in server side ?

Doing this is showing me the &nbsp as text. ( ofcourse since we're dealing with myLabel.Text which holds a text)

I've also tried :

HttpUtility.HtmlEncode(s + "&nbsp;" + val);

any help ?

like image 642
Royi Namir Avatar asked Aug 30 '12 11:08

Royi Namir


1 Answers

&nbsp; is a different character than space - it is Unicode code point 00A0. See on Wikipedia.

If you use that character, you should be getting a non breaking space.

like image 74
Oded Avatar answered Nov 15 '22 08:11

Oded