Let's say that I've got one custom webcontrol called MyControl.
[ParseChildren(true)]
public partial class MyControl: WebControl {
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
[PersistenceMode(PersistenceMode.InnerProperty)]
public IComplex Complex { get; set; }
}
The control is a very simple control but it holds an instance of a complex type that is accessable through a property. The property has the propertytype IComplex
public interface IComplex {
string Name { get; set; }
List<IComplex> Children {get;}
}
Let's say that I am able to pick one of several different types of object that derives from IComplex in design-time and assign it to the controls property "Complex" property.
Naturally I would like to persist this information to the HTML-View in a user-friendly way.
Because we don't know what type the user has picked there is no way to instansiate the type if we don't persist the name of that type. The Type could also contain more properties than the Interface the controls property is refering.
<cc1:MyControl id="MyControl1" runat="server">
<Complex> <!-
View Complete Post