Welcome to WebmasterWorld Guest from 54.147.134.218

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)

Junior Member

10+ Year Member

joined:Aug 21, 2003
posts:74
votes: 0


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)

Junior Member

10+ Year Member

joined:Apr 3, 2005
posts:102
votes: 0


You could try:

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

HTH,

Mark

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

Junior Member

10+ Year Member

joined:Aug 21, 2003
posts:74
votes: 0


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)

Junior Member

10+ Year Member

joined:Aug 21, 2003
posts:74
votes: 0


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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:May 31, 2005
posts:1108
votes: 0


For URL's use Server.URLEncode()
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members