Sunday, July 18, 2010

How to build a templated control - Asp.net

[ParseChildren(true)]
public class CustomControl : WebControl
{
    public ContentItem Item { getset; }
 
    [PersistenceMode(PersistenceMode.InnerProperty)]
    [TemplateContainer(typeof(ContentItem))]
    public ITemplate ContentTemplate { getset; }
 
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        this.CreateControlHeirarchy();
 
    }
    public void CreateControlHeirarchy()
    {
        this.Item = new ContentItem();
        this.Controls.Add(Item);
        this.ContentTemplate.InstantiateIn(this.Item);
    }
 
}
 
public class ContentItem : WebControlINamingContainer
{
}

No comments:

Azure Storage Account Types

Defferent Types of Blobs Block blobs store text and binary data. Block blobs are made up of blocks of data that can be managed individually...