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; }
}

Comments

Popular posts from this blog

Create a draft release and start it using the TFS REST API

Adding a delay before processing Textbox events

Change the deployment URL of a ClickOnce application