View Single Post
  #1 (permalink)  
Old August 19th, 2010, 02:39 AM
chroniclemaster1 chroniclemaster1 is offline
Friend of Wrox
Points: 1,749, Level: 16
Points: 1,749, Level: 16 Points: 1,749, Level: 16 Points: 1,749, Level: 16
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2007
Location: San Diego, CA, USA.
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default Invisible Post-processing

I've used literal controls from time to time, especially when I need to generate some custom HTML and don't want the <span> tags around it which a label would generate. But I've never run into unexpected behavior before, literal has always simply output the string I feed it.

I'm outputting a string to a literal control. The string contains several values concatenated. Here's a snippet of the output code in an abstract class.

outputString += "<" + classTagName + getAttributes() + "/>";

In my implemented class I've defined this variable in the constructor

classTagName = "input type='radio'";

So how on earth can this produce the output...

<input ...lots of attributes... type="radio" />

The single quotes have become double quotes and the the attributes have been spliced into the middle of my string variable. Obviously, this isn't going to kill me, but I would like to know what's going on. (Before I do something that will kill my program.)

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of
A Growing History of our Planet, by our Planet, for our Planet.