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:

iPhone Launch Screen Sizes

iPhone Portrait iOS 8 Retina HT 5.5 = 1242 X 2208 Retna HD 4.7 = 750 X 1134 iPhone Landscape iOS 8 Retina HD 5.5  2208 X 1242 iPho...