ASP 101 - Active Server Pages 101 - Web06
The Place ASP Developers Go!



Windows Technology Windows Technology
15 Seconds
4GuysFromRolla.com
ASP 101
ASP Wire
VB Forums
VB Wire
WinDrivers.com
internet.commerce internet.commerce
Partners & Affiliates
ASP 101 is an
internet.com site
ASP 101 is an internet.com site
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

ASP 101 News Flash ASP 101 News Flash



 Top ASP 101 Stories Top ASP 101 Stories
Connections, Commands, And Procedures
What is ASP?
VBScript Classes: Part 1 of N

QUICK TIP:
Close and free up object references
Show All Tips >>
ASP 101 RSS Feed ASP 101 Updates


Quick Tips


Always Put "s Around Your Data

One of out visitors came up with this extremely worthwhile tip. When using ASP to fill in the attributes of HTML tags, make sure the values have double quotes around them. Here's why...

First of all, it is a good programming practice to always double quote dynamically generated ASP data since you never know what's going to be in it. This is especially helpful for things like the value attribute of an input element and for data coming from a database field where it might not be apparent that the data contains imbedded spaces.

For example... assume the value in the recordset field contains the string "Class C". While this code:

<input name="class" value="<%= rsDC.Fields("class").Value %>">

would produce the desired results, this code:

<input name="class" value=<%= rsDC.Fields("class").Value %>>

would give you "Class" when you went to retreive the value on a subsequent page. Worse yet, if most of your data doesn't have spaces, this can make for hours of frustrating troubleshooting when you run across a piece of data that does.

 

Thanks go out to Tom Kwasniewski for this Quick Tip.


Previous      Show All Tips      Next

If you have a tip you would like to submit, please send it to: webmaster@asp101.com.


Home |  News |  Samples |  Articles |  Lessons |  Resources |  Forum |  Links |  Search |  Feedback

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers