Copied to clipboard

Flag this post as spam?

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


  • Rohan 105 posts 162 karma points
    Sep 19, 2014 @ 14:16
    Rohan
    0

    getting error , "dictionary requires a model item of type 'Umbraco.Web.Models.RenderModel' "

    Hi Experts

    we are using controller of Umbraco.Web.Mvc.SurfaceController in MVC application like below

    public ActionResult umbUploadImage()        {

                EditorInputModel obj = new EditorInputModel()

                {              

                    URLProfile = "test"

                };

                return View("umbUploadImage", obj);

            }

    when we call without master page like below 

    @model MVCWall.Models.EditorInputModel

    @{

        ViewBag.Title = "umbUploadImage";

    }

     

    it will run perfectly and i am able to browse the web.

    But when we add Umbraco Master page like below the proble STARTS

    @model MVCWall.Models.EditorInputModel

    @{

        ViewBag.Title = "umbUploadImage";

         Layout = "~/Views/Wall.cshtml";    

    }

    and when we run , it's throwing below error

    The model item passed into the dictionary is of type 'MVCCreateWall.Models.EditorInputModel', but this dictionary requires a model item of type 'Umbraco.Web.Models.RenderModel' "

    Can anyone please help me here ?

    Thanks in advance 

    Rohan

  • Ismail Mayat 4511 posts 10091 karma points MVP 2x admin c-trib
    Sep 22, 2014 @ 10:34
    Ismail Mayat
    0

    Rohan,

    Is your class EditorInputModel ineriting from RenderModel? If not then it needs to, also you will need to create an overloaded constructor for it e.g

    public class EditorInputModel:RenderModel{
      public EditorInputModel():base(UmbracoContext.Current.PublishedContentRequest.PublishedContent)
    }

     

     

Please Sign in or register to post replies

Write your reply to:

Draft