November Happy Hour will be moved to Thursday December 5th.

Render pages in ContentArea (Webforms)

Vote:
 

Hi!

I've seen a lot of guides on how to render pages in ContentAreas in MVC but I can't find any guides on how to do that in Webforms. Is there an easy way to do that?

#88507
Jul 15, 2014 13:55
Vote:
 

Hi,

Have you installed the Visual Studio Tools? There are templates for partial controls.

Basically you create a new user control and inherit from ContentControlBase. Then you can decorate the user control with the TemplateDescriptor attribute, e.g.:

[TemplateDescriptor(
    Inherited = true, 
    AvailableWithoutTag = true)]
public partial class NewsArticleTeaser : ContentControlBase
{
}
#88515
Jul 15, 2014 16:53
Vote:
 

Thank you! Exactly what I was looking for :)

#88535
Jul 16, 2014 11:56
Vote:
 
If you use [TemplateDescriptor()] as mentioned above you can also control where the pages are allowed to be rendered as well by using Tags = string []  {"YourTagName"} 
Then you use RenderSettings on your episerver:property-webcontrol to set the tag name as well
#88536
Jul 16, 2014 12:22
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.