This is happening because of the way you are generating the link, ASP.NET Label
controls translate to an html span
element and the text is what goes between the opening and closing tags. Basically what is happening is you have broken html and your browser is appending additional opening and closing a
tags and making duplicates in the process.
Your rendered output looks like this:
<span>
<a class=fancybox rel=group href=picture0.ashx?id=someid>
<img src=yoursrc/>
</span>
</a>
Change your Label
controls to Literals
and your code should work, you should also enclose your html attributes in quotes.
EDIT: Unless there is a reason to create the control in the codebehind I would suggest using the ASP.NET markup and then setting the properties you need to fill out dynamically in the codebehind.