Copied to clipboard

Flag this post as spam?

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

  • Matthew Wise 265 posts 1282 karma points MVP 3x c-trib
    Aug 30, 2018 @ 14:11
    Matthew Wise

    Models Builder custom property not defined in view file


    I have a models builder class that I have extended to include a filter class which compiles and is accessible within my controller.

    However when I go to the page I get :

    CS1061: 'RenderModel<ArticleListing>' does not contain a definition for 'Filters' and no extension method 'Filters' 
    accepting a first argument of type 'RenderModel<ArticleListing>' could be found (are you missing a using directive or an assembly reference?)

    Visual studio also tells me this only in the view

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<Umbraco.Web.PublishedContentModels.ArticleListing>
    @using (Html.BeginUmbracoForm<ArticleListingController>("FilterArticles", null, new { @class = "listing-form", data_api = Url.SurfaceAction<ArticleListingController>("PagedArticles") }, FormMethod.Post))
        @Html.DropDownListFor(m => m.Filters.FilterDate, Model.Filters.FilterDates)
        @Html.HiddenFor(m => m.Filters.ItemsPerPage)
        @Html.HiddenFor(m => m.Filters.OrderAscending)
    @Html.Partial("PagedArticles", Model.Results)

    Partial class definition:

    namespace Umbraco.Web.PublishedContentModels
        public partial class ArticleListing 
            public ArticleListingFilters Filters { get; set; }
            public Page<IPublishedContent> Results { get; set; }



  • Frederik Raabye 72 posts 276 karma points MVP 2x c-trib
    Aug 30, 2018 @ 14:27
    Frederik Raabye

    Not too sure but UmbracoViewPage instead of UmbracoTemplatePage when you don't need dynamics?

  • Matthew Wise 265 posts 1282 karma points MVP 3x c-trib
    Aug 30, 2018 @ 14:29
    Matthew Wise

    Thanks :) Works perfectly missus my other failings


  • Nik 1517 posts 6705 karma points MVP 5x c-trib
    Aug 30, 2018 @ 14:39

    Also, if you did use UmbracoTemplatePage then this....


    needs to be


    Just for future reference :-)

    On UmbracoTemplatePage the actual model you define is located on Model.Content as Model is the RenderModel.

Please Sign in or register to post replies

Write your reply to: