PageTypeBuilder - Inherting from TemplatePage



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?

Jan 17, 2012 14:57

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>



Jan 17, 2012 19:46

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.

Jan 18, 2012 14:39
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.