Developin webparts with many UI elements can be a hassle - which is why I'm fond of the UserControl shortcut - I build my web UI as a WebUserControl, then simply have my webpart call Page.LoadControl to dynamically load that usercontrol.

A problem I've encountered with it today is that LoadControl, strangly enough, ignores HTML comment in the ASCX file.

Let's say I have the following code in the ASCX:


This should instantiate only one Repeater object - and does, when the ASCX is hosted normally inside an ASPX page.
When I load it dynamically, though, I get an exception in LoadControl stating that "Parse Error: A control named Repeater1 is already defined" - meaning that for some reason it parses the first control too, even though it's commented out.
If I erase the commented section, it runs as planned.

Anyone know why it ignores my markup?