For some reason the HtmlTextWriter is inserting weirdness into my html output. In the following code I try to create a clickable div that contains an image:
writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "location.href = '"
+ TargetHTTPRef + "'");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
writer.AddAttribute(HtmlTextWriterAttribute.Src, ThumbFileName);
writer.RenderBeginTag(HtmlTextWriterTag.Img);
writer.RenderEndTag();
I get the following output:
<div class="leftGallery" onclick="location.href = 'http://www.google.com'">
<img src="./images/services/47_Kayak%20Thumb.jpg" /><div class="galleryPanel">
So I'm getting ' and %20 occurring where the apostrophes and spaces should be in the output. Is there a way to stop this??