Literal Text in a User Control
30 May 2008
I've been creating a couple of improved ASP.NET controls such as a label which actually renders as a label with a for attribute which will point at the right control after ASP.NET has mangled the ids.
Turns out to be fairly difficult to find information about just using the literal content of a User Control, but simple to implement. Just add the ParseChildren attribute to your User Control's class and set it to true and supply the name of the field it should put any literal content into.
e.g. [ParseChildren(true,"Text")]
Which will populate the Text attribute with the inner html of the user control.

