简体   繁体   中英

Umbraco render strongly typed partial from api

What i'm trying to do:

  • call an UmbracoApiController method from js
  • do some server side processing
  • return a partial view with a custom model as a string

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/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.

Some help please?

I normally call (with js, ajax, jquery) an Umbraco Surface controller and I pass my current page's node 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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM