Quick tip: Templated controls
on August 1st, 2012
Leave a Comment
If you create a templated server control, import it into your web-site or web application and you want to do:
<my:Control ID="myControl" runat="server">
<ItemTemplate>
Some text, html or whatever.
</ItemTemplate>
</myControl>
and you are allowed to do only:
<my:Control ID="myControl" runat="server" />
you need to modify your ItemTemplate property to look like this:
[TemplateContainer(typeof(MyTemplateControl))]
[Browsable(false)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public ITemplate ItemTemplate {
get { ... }
set { ... }
}
Categories: Tech stuff
Leave a Reply