AI OnAI Off
For the user control you inherit from your abstract UserControl base class and set T to be the page type.
public partial class MyUserControl: UserControl<MyPageType>
Frederik
Yes, but if my usercontrol may exist on multiple pagetypes I need to inherit from UserControl<TypedPageData> and then I cannot access TemplatePage<T> from the usercontrol.
Anyway I did solve this by a workaround where I took PageTypeBuilder.TemplatePage<> and let it inherit from my own base TemplatePage instead of EPiServer.TemplatePage.
Hello,
I just started to use Pagetypebuilder but I'm having trouble working with the TemplatePage<> and UserControlBase<>. I've created my own own base class for templates which looks like this
public abstract class TemplatePage<T> : PageTypeBuilder.UI.TemplatePage<T> where T : TypedPageData {}
That's fine. I also have a usercontrol:
public abstract class UserControl<T> : PageTypeBuilder.UI.UserControlBase<T> where T : TypedPageData {
public TemplatePage<T> TemplatePage { get { return Page as TemplatePage<T>; } }
}
My problem is accessing the TemplatePage from the UserControl. Since that is not allowed in C#. Anyone got a solution for this?