Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,
i am fetching text from database into label its working fine, but it is not showing the lots of white space between the text...?how it is possible to show text same as it is in databse...
Posted

When you send data to a web browser, it squashes strings of spaces to a single space - regardless of the data source. To get round this, convert your spaces to " " which are always shown as a single space character and do not get squashed into a single spaces.
You could use string.Replace(" ", " ") on your string before you set the label.Text value.

[edit]Arrgggh! Browser swallowed the ampersand nbsp semicolon and replaced it with space! - OriginalGriff[/edit]
 
Share this answer
 
v2
Comments
mohansahu 6-Jul-12 9:05am    
i am fetching data from database and showing it in label..in repeater how it is possible to show data same as from database with sapce and new line
OriginalGriff 6-Jul-12 9:14am    
In your SELECT statement, use the SQL REPLACE function to change the spaces before they are returned.
mohansahu 6-Jul-12 9:53am    
no its not working..
OriginalGriff 6-Jul-12 10:02am    
Without the SQL code you used, that is a very pointless remark...:laugh:

For presenting spaces within an HTML page you can use the   entity.


Just replace your spaces with   entities.


For more information about HTML entities, you can see that link: http://www.w3schools.com/html/html_entities.asp[^].

 
Share this answer
 
v3
Hello try this code


<asp:label style="letter-spacing: 3px;" id="Label1" runat="server" />
 
Share this answer
 
v3
Comments
mohansahu 6-Jul-12 9:04am    
its not workin..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900