Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Allow White Spaces between Words

Author  Topic 

raghulvarma
Starting Member

21 Posts

Posted - 2010-02-06 : 20:38:08
I am using asp.net 1.x, Here i will have to store the values in the database along with the white spaces
for eg: "My New Thread"
here I have given spaces between these words (could not be seen in the preview as it takes only one spacing between each word) but when i save them or try to display them in a Label or in a grid the spaces between them are reduced and only one space is shown between each words how to solve this?
Another question is, is that possible to have blank spaces at the end of a word for eg: "Threading " (could not be seen in the preview as it takes only one spacing between each word), if so is it possible to show as I have given in this example in the grid by databinder.Eval(Container.DataItem, "firstName")
ie:
<asp:Label id="label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "firstName") %>
because eval trims the blank spaces!!
Regards
Raghul

Kristen
Test

22859 Posts

Posted - 2010-02-07 : 02:30:48
"(could not be seen in the preview as it takes only one spacing between each word)"

So you didn't bother to read about formatting
on this f o r u m?

" when i save them or try to display them in a Label or in a grid the spaces between them are reduced and only one space is shown between each words how to solve this"

This is an HTML question. Look up   or <pre>

"is that possible to have blank spaces at the end of a word"

SQL Server will store what you give it. Trailing and leading whitespace may be stripped off by whatever you are using to enter and submit the data

DECLARE @TEMP TABLE
(
TestString varchar(100)
)

INSERT INTO @TEMP
SELECT 'aaa' UNION ALL
SELECT ' bbb' UNION ALL
SELECT 'ccc ' UNION ALL
SELECT ' ddd '

SELECT TestString + '['
FROM @TEMP

Results:
aaa[
bbb[
ccc [
ddd [

Go to Top of Page

MrQuizzles
Starting Member

20 Posts

Posted - 2010-02-08 : 16:11:59
http://www.w3schools.com/css/pr_text_white-space.asp
Go to Top of Page
   

- Advertisement -