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
    Dec 10, 2013 @ 13:53
    Jeric
    0

    Error with Custom Controllers

    I'm running Umbraco V6.1.6

    And i'm having the below error when I render the page

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

    I'm not so sure where went wrong.

    Anyone have any idea? Appreciate all the help

    Thanks

    My Model Class

    public class BaseContentModel : RenderModel
        {
    
            public BaseContentModel(IPublishedContent content, CultureInfo culture) : base(content, culture)
            {
            }
    
            public BaseContentModel(IPublishedContent content) : base(content)
            {
            }
    
            public string Title
            {
                get { return Content.GetPropertyValue<string>("alternativeTitle"); }
            }
        }
    

    My Controller

    public class HomepageController : RenderMvcController
        {
            public override ActionResult Index(RenderModel model)
            {
                //Do some stuff here, the return the base Index method
                return base.Index(model);
            }    
        }
    

    My View

    @inherits Umbraco.Web.Mvc.UmbracoViewPage<BaseContentModel>
    @{
        Layout = null;
    }
    
    <html>
        <head>
    
        </head>
        <body>
            <h2>@Model.Title</h2>       
    
        </body> 
    </html>
    
Please Sign in or register to post replies

Write your reply to:

Draft