Last active
November 11, 2019 20:49
-
-
Save jeremy-farrance/cb1bde1834e3223e233c5659c60a1d40 to your computer and use it in GitHub Desktop.
DNN RazorHost or DDRMenu RazorScript to access 2sxc data (Content-Types) using AsDynamic()
Here is the related article, but note that (as of Nov 2019) the "Working with Data" example is wrong (just a duplicate of the "Render" example above it).
From a .ascx you could do this:
<script runat="server">
private IHtmlString RenderOutput()
{
return ToSic.SexyContent.Environment.Dnn7.Factory.SxcInstanceForModule(3354, 606).Render();
}
</script>
<%=RenderOutput() %>
Note: probably a good opportunity to use object (DNN) caching?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that if you have any 2sxc Content App on a page, just replace that ModuleID and TabID above and you will get output. The Count will be the number of records in your Content-Type: Content (Basic) - 2sxc v10.09.x