Copied to clipboard

Flag this post as spam?

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

  • Jeric 122 posts 192 karma points
    Mar 27, 2015 @ 17:34

    EnablePreview set to true with CustomController

    I've set the "enabledPreview" to true within the grid config , but I'm having issue displaying a view with a custom controller within the grid. It shows the below error

    The model item passed into the dictionary is of type 'TestApplication.ViewModels.QuoteViewModel', but this dictionary requires a model item of type 'Umbraco.Core.Models.IPublishedContent'.

    Any way to go around this?


  • Wesley Herpoelaert 52 posts 123 karma points
    Mar 27, 2015 @ 21:26
    Wesley Herpoelaert

    Hi Jeric,

    I fixed this by returning the view without the model in the custom controller.

    //Check if it's a grid preview
    bool preview = Request.QueryString["dtgePreview"] == "1";
    if (preview)
        return View();


  • Jeric 122 posts 192 karma points
    Mar 29, 2015 @ 12:02

    Hi Wesley,

    At the top of your view, do you still use any @model?

    Can you share how your view and controller looks like (a sample will be great).


  • Jeric 122 posts 192 karma points
    Mar 30, 2015 @ 14:09

    Tried that, i'm calling a different view when there's a preview but another error appear showing the below

    "Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space."

  • Matt Brailsford 2814 posts 14400 karma points MVP 7x c-trib
    Apr 02, 2015 @ 09:09
    Matt Brailsford


    I take it you are trying to pass down a custom, strongly typed model? If so, did you update your view to the following?

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<QuoteViewModel>

    If you are passing down a strongly typed view model, you need to update your view to let it know what model to expect. By default it'll expect IPublishedContent, but if you change that, you need to let it know.


  • Jeric 122 posts 192 karma points
    Apr 02, 2015 @ 12:24

    Thanks Matt, let me try that out

Please Sign in or register to post replies

Write your reply to: