Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An example for how a DocType Grid Editor partial view should look with the DTGE: Reusable Content Extension
@inherits UmbracoTemplatePage
@{
// Set a variable to use the default content if no linked content has been selected
var content = Model.Content;
// Check to see if there's a linked page value
if(Model.Content.HasProperty("dtgeLinkedId") && Model.Content.HasValue("dtgeLinkedId"))
{
// Run the linked page value through Umbraco.TypedContent() to get the IPublishedContent page
var dtgePage = Umbraco.TypedContent(Model.Content.GetPropertyValue("dtgeLinkedId"));
// The value shouldn't ever be null, but weird things happen, so let's just make sure
if(dtgePage != null)
{
// Set the content to use the linked page instead of the default DTGE values
content = dtgePage;
}
}
}
@* Now you can do anything you want with any version of the content in your view! *@
@content.GetPropertyValue("propertyExample");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment