Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • James 251 posts 1169 karma points
    Aug 21, 2015 @ 14:40
    James
    0

    String Builder - UmbracoApiController Ajax

    Hello,

    Does anyone have an alternative to string builder when creating the html mark-up in an UmbracoApiController to pass back to a view via an Ajax call?

    At the moment I'm passing back blog post previews which is 7-10 lines of mark-up. It seems like a clunky way of doing it building it in string builder.

    Thanks and kind regards,

    James.

  • Alex Skrypnyk 6182 posts 24284 karma points MVP 8x admin c-trib
    Aug 21, 2015 @ 14:44
    Alex Skrypnyk
    100

    Hi James,

    You can use this approach for rendering view to string and then return it for ajax request.

    http://stackoverflow.com/questions/9243433/how-to-render-a-razor-view-to-a-string-in-asp-net-mvc-3

    And maybe it will be better to fill html markup on client side ? Get data from server in json and fill html template with this data.

    Thanks, Alex

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies