2

Until now I've just only recovered components from Tridion in my DXA using ContentProvider.GetEntityModel. The thing is that now I need to create pages and add components to them. I have created a test page (test.html) with only one component with some text fields.

I have created this controller in my DXA:

enter image description here

In the Global.asax:

enter image description here

I've created a view for my page (MainPage) that only contains this:

enter image description here

I have also a View for the Region Main containing:

enter image description here

I also have a model for my component (with all the semantics necessary):

enter image description here

And a controller (it doesn't do much for the moment), which is the one specified in the component template:

enter image description here

And a view Story (which is the one specified in the component template) containing a simple text.

I have registered all:

enter image description here

I thought that doing this the application would load the main view and then it would enter in each controller associated to the components included (in this case only one), but it keeps failing here:

enter image description here

I don't know if I'm not understanding how this works or if I've configured someting wrongly, could anybody help me here?

Thanks a lot

Mer

7
  • Can you check and provide what error you are getting in site log file. Oct 9, 2018 at 10:46
  • @SayantanBasu It's the same I saw in Visual Studio: 2018-10-09 12:44:04,388 [6] ERROR - Execution of the child request failed. Please examine the InnerException for more information. System.Web.HttpException (0x80004005): Execution of the child request failed. Please examine the InnerException for more information. ---> System.Web.HttpException (0x80004005): The controller for path '/test.html' was not found or does not implement IController.was not found or does not implement IController.
    – Mer
    Oct 9, 2018 at 10:52
  • How does your AreaRegistration look? What is the namespace of this AreaRegistration and what is the namespace of your StoryController? Which DXA version are you using? Oct 12, 2018 at 6:12
  • Hint: see the comment in BaseAreaRegistration.RegisterArea Oct 12, 2018 at 6:17
  • 1
    Ok, so your AreaRegistration is in namespace Sdl.Web.Site. Where is your Controller? Oct 24, 2018 at 16:40

1 Answer 1

1

It also required to configure meta data of component templates and page template to use custom controllers. Also with the change of controller names you require to change the path of corresponding views. We can relate this with OTBut of the box DXA demo site, Component View's folder name is Entity as component templates are configured to work with EntityController. Similarly for Page Views folder name is Page as it is using PageController.

You should go through documentation to implement custom area and place custom controllers and views there.

2
  • Hi Mukesh, I've already configured the metadata of both templates indicating the controller and the view in each case. What do you mean with "Also with the change of controller names you require to change the path of corresponding views"? I have 3 folders in the Views Folder inside my area: Entity (containing the view of Story), PageX (that's the name of the controller configured in the page template, containing the MainPage view) and Region (containing the Main view). Thank you for your help
    – Mer
    Oct 11, 2018 at 11:24
  • I have updated my answer to reflect your queries. Please check if this can help you further identify your issue. You can relate DXA application with any standard MVC application for Views, controllers and routing. Oct 11, 2018 at 14:18

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.