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
    Jeric
    0

    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?

    Thanks

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

    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();
    }
    

    Wesley

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

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

    Thanks 

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

    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 4124 posts 22215 karma points MVP 9x c-trib
    Apr 02, 2015 @ 09:09
    Matt Brailsford
    1

    Jeric,

    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.

    Matt

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

    Thanks Matt, let me try that out

Please Sign in or register to post replies

Write your reply to:

Draft