I have a custom field in Sitecore - a composite field with a number and a rich text editor.
The editor side of things works great, but when the field is rendered without the page editor, I'd like to delegate the formatting of it to a cshtml file - sending an object of my choosing in as the model.
I can intercept the rendering in DoRender:
protected override void DoRender(HtmlTextWriter output)
{
if (!Sitecore.Context.PageMode.IsPageEditor)
{
//here is where I want to delegate the output to a cshtml DisplayTemplate with the Value as the Model.
}
else
{
base.DoRender(output);
}
}
But how do I delegate the output to a cshtml DisplayTemplate with the Value as the Model?