A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

Custom renderer for ContenentReference will not work

Vote:
 

I would like to use a custom render for a Content Reference Property (PageLink). Here is an example of the custom renderer:

[TemplateDescriptor(TagString = "MyCustomRenderer")]
public class PropertyPageReferenceCustomControl : PropertyPageReferenceControl, IRenderTemplate<ContentReference>
{
	public override void CreateDefaultControls()
	{
		base.CreateDefaultControls();

	// I need todo some stuff here but this template is never rendered.

	}
}

And how I am calling it from a control

<EPiServer:Property ID="Property1" PropertyName="PageLink" runat="server">
    <RenderSettings Tag="MyCustomRenderer" />
</EPiServer:Property>

I want to be able to manipulate the way the PageLink is rendered but with the above, my custom renderer is simple not used.

I have other custom renders working in the same project but for different types. i.e

[TemplateDescriptor(TagString = "UrlWithTitle")]
public class PropertyUrlWithTitleControl : PropertyUrlControl, IRenderTemplate<Url>

Can anyone see what I am doing wrong with the PropertyPageReferenceControl custom renderer?

 

#70097
Apr 11, 2013 17:55
Vote:
 

Your render template is set to ContentReference and your class is inheriting from PropertyPageReferenceControl - is it possible that you need to use PropertyContentReferenceControl? (I don't use web forms, only MVC)  I'm not sure if the PropertyPageReferenceControl works with ContentReference.  I could be wrong though, check it out.  Notice how your Url template descriptor is rendering for a Url and a PropertyUrlControl.

#70108
Apr 11, 2013 21:19
Vote:
 

Hi Mike

Initially, those where also my thoughts but no PropertyContentReferenceControl exists. Also, PageReference inherits ContentReference of which I have tried both in IRenderTemplate<T> without success.

Adam

#70120
Apr 12, 2013 9:23
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.