[英]Umbraco render strongly typed partial from api
What i'm trying to do: 我正在尝试做的是:
I've found helpful answers like: 我找到了有用的答案,例如:
http://our.umbraco.org/wiki/reference/code-snippets/razor-snippets/render-razor-scripts-for-emails-and-more/create-string-of-partial-view-for-emailing http://our.umbraco.org/wiki/reference/code-snippets/razor-snippets/render-razor-scripts-for-emails-and-more/create-string-of-partial-view-for-emailing
http://our.umbraco.org/forum/developers/api-questions/44916-615-Returning-Partial-View-as-string-to-JSON http://our.umbraco.org/forum/developers/api-questions/44916-615-Returning-Partial-View-as-string-to-JSON
But I can't figure out what Controller or ControllerContext to pass in since I'm not in a Razor view or RenderMvcController. 但由于我不在Razor视图或RenderMvcController中,因此我无法弄清楚要传递的Controller或ControllerContext。
Some help please? 请帮忙吗?
I normally call (with js, ajax, jquery) an Umbraco Surface controller and I pass my current page's node id. 我通常调用(使用js,ajax,jquery)Umbraco Surface控制器,然后传递当前页面的节点ID。 Then on server, I do:
然后在服务器上,我这样做:
var currentPage = Umbraco.TypedContent(myNodeIdParam);
From there I usually have enough context and I can return a partial view, passing it a model I want. 从那里,我通常有足够的上下文,并且我可以返回局部视图,并向其传递我想要的模型。
Hope this helps! 希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.