I have 2 different 2sxc apps on my site - I'll refer to them as App1 and App2. A content type in App1 uses a "String dropdown-query" field to get the GUID of an entity from App2.
Within an App1 view, I am using that GUID in a query (using App.Query) to retrieve the entity data from App2. This all works successfully; I have no trouble displaying this data.
// App1 View
...
var getPlaylist = App.Query["Get Playlist by GUID"];
getPlaylist.Params("PlaylistId", "16705");
var playlist = AsList(getPlaylist["Default"]).First(); // Returns entity data from App2
<p>@playlist.EntityTitle</p> // App2 data displays correctly
Additionally, I would like to render a view from App2 within App1, passing in the entity data from App.Query. This is almost working correctly.
@RenderPage("/portals/0/2sxc/Artifact-Library/_ResourcesDownload.cshtml", new { Content = playlist })
When the view is rendered, the entity data all displays correctly. However, additional context from App2 seems to be lost; e.g. the toolbar buttons raise an error when clicked (included below), and any references to App2's settings or resources returns empty.
Had an error talking to the server (status 400),
Message: Bad Request
Detail: Object reference not set to an instance of an object.
Is there a way I can preserve App2's context within App1's view? Or is there at least a way to make the toolbar work?
I believe you should use the
IRenderService
- ideally on theKit.Render
- probably something like: