Welcome to WebmasterWorld Guest from 174.129.151.95

Forum Moderators: ocean10000

Message Too Old, No Replies

Adding html tags to string

SQL output to web

   
4:30 pm on Nov 14, 2005 (gmt 0)

10+ Year Member



I use SQL output to create a drop-down list and to validate my web page. I'm trying to figure out a way to convert special chars into html code i.e. & to & and so on. What is the ASP syntax that I should use to do so? My current code is:


<tr>
<td><% response.write rs.fields(1).Value%></td>
</tr>
9:27 pm on Nov 14, 2005 (gmt 0)

10+ Year Member



You could try:

<% response.write Server.HTMLEncode( rs.fields(1).Value ) %>

HTH,

Mark

12:34 pm on Nov 15, 2005 (gmt 0)

10+ Year Member



Thanks! Is there any list of ASP utilities like Server.HTMLEncode() on site that I can use?

Thanks,

Scott

6:09 pm on Nov 15, 2005 (gmt 0)

10+ Year Member



Ah, what about %20 for space? Server.HTMLEncode doesn't do that ... To prevent deformed anchor links.
8:54 pm on Nov 15, 2005 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



For URL's use Server.URLEncode()