472,127 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

How to avoid space trimming in HTML

33
Hi,

I have a search page in which I take data from a recordset. Some data which is retrieved may have more than one space between 2 words. But in my result page, HTML is truncating those spaces into single space and displays the result. But I need it as it is in the database. Is there any way similar to &nbsp which can be applied to this situation? My code is as follows:

<TD nowrap borderColor=maroon width="180"><FONT size=3><%=rs(0) %></FONT></TD>
in which rs(0) is the field containing spaces.

Plz help me..

Thanks in advance

Matsam
Aug 30 '07 #1
4 1832
nedu
65
Hi,

You shall use the following code to allow spaces while accessing the DB.

Response.Write "<PRE><font face=monospace size=10>" & Rs.Fields(0) & "</font></PRE>"

Let me know for any other queries . . .

Regards,
Nedu. M
Aug 30 '07 #2
Matsam
33
Hi,

You shall use the following code to allow spaces while accessing the DB.

Response.Write "<PRE><font face=monospace size=10>" & Rs.Fields(0) & "</font></PRE>"

Let me know for any other queries . . .

Regards,
Nedu. M

Hi,

Thanks for your help. But I'm sorry, my problem still remains open...
Actually I want to take records from a table and populate it into a combo box. The <PRE> tag is not working in this case.. Other situations it is ok. Following is my code:

<SELECT id=select4 style="WIDTH: 256px; HEIGHT: 22px"
name=lstSubject>
<% do while not rs3.EOF %>
<OPTION > <PRE> <%=rs3(0) %> </PRE> </OPTION>

<% rs3.MoveNext
loop
rs3.close %>

</SELECT>

where rs3 is my recordset.

Here nothing happens on including <PRE> tag.

Pls help..

Thanks again

Matsam
Aug 31 '07 #3
nedu
65
Hi Mastam,

Use the following code

<Select>
<%
While Not Rs.EOF
Txt = Replace(rs.Fields(0)," ", "&nbsp;")

%>
<option value="<%=Txt%>"><%= Txt %></option>
<%
Rs.MoveNext
wend
%>

</Select>

Let me know for any other queries.

Regards,
Nedu . M
Aug 31 '07 #4
Matsam
33
Hi Mastam,

Use the following code

<Select>
<%
While Not Rs.EOF
Txt = Replace(rs.Fields(0)," ", "&nbsp;")

%>
<option value="<%=Txt%>"><%= Txt %></option>
<%
Rs.MoveNext
wend
%>

</Select>

Let me know for any other queries.

Regards,
Nedu . M
Hi Nedu,

Thanks a lot for ur help. Now my problem is solved.
Thanks again...

Regards
Matsam
Sep 1 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by shank | last post: by
3 posts views Thread by |-|erc | last post: by
3 posts views Thread by Wim Roffal | last post: by
4 posts views Thread by Aaron | last post: by
8 posts views Thread by Stanley | last post: by
1 post views Thread by 418928 | last post: by
Frinavale
4 posts views Thread by Frinavale | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.