Create UserControl with inline content

Let's say you want to create a user control that contains some literal text:
<uc1:InlineContent>
    This is some standard text message
</uc1:InlineContent>
Here is the simplest UserControl that matches this description:
using System.Web.UI;

[ParseChildren(ChildrenAsProperties = true,
               DefaultProperty = "Content")]
public partial class InlineContent : System.Web.UI.UserControl
{
    [PersistenceMode(
        PersistenceMode.EncodedInnerDefaultProperty)]
    public string Content { get; set; }
}

Popular posts from this blog

Handling exceptions the right way in WCF (part 2)

Adding a delay before processing Textbox events

Change the deployment URL of a ClickOnce application