2

I'm trying to make a new Page View / Page Template in the DXA 1.7 Sample site, using my own Module, but it will not render the Entity View (or Region with an Entity View).

I've created an Area and Folder structure for the items, and I've registered my Region and Page View, as well as putting my module namespace in the Views config. I've also done the Metadata ceremony on the Templates in the CMS, published the 'Publish Settings' page and also the Page. However, after all these steps, it still doesn't work. I'm sure I missed something simple - what could it be?

Error:

The model item passed into the dictionary is of type 'Sdl.Web.Common.Models.RegionModel', but this dictionary requires a model item of type 'Sdl.Web.Common.Models.PageModel'

I am using my own Area, RC, and I have the folder structure:

/Areas/RC/Views/Page
/Areas/RC/Views/Region

In the Page View I use the following syntax to attempt to show my RcMain Region and the Entity View:

 @Html.DxaRegion("RcMain", containerSize: mainContainerSize)

In the Region folder I have a Region with the code:

@model RegionModel
<div @Html.DxaRegionMarkup()>
    @Html.DxaEntities()
</div>

In the APA Area Registration I have:

RegisterViewModel("ApaMain", typeof(RegionModel));

I also registered my Page View and Entity View.

Page Metadata: enter image description here

1
  • 1
    In the screenshot I see a Region View called RcMain, but you register a Region View called ApaMain? The error message suggests that your Region View contains a @model PageModel statement. Jun 8, 2017 at 19:17

1 Answer 1

2

Have you registered the page model as well,

RegisterViewModel("DefaultPage", typeof(PageModel), "Page");

and is your Page using

@model Sdl.Web.Common.Models.PageModel 

and not the regionmodel

You could turn the DXA WebApp log level to Debug in the log.config file to get more insights

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.