Calling PageData to PageTemplateProperties

Matthew Stone asked on December 4, 2024 17:34

Hello I am using Kentico 13 .netcore.

What would be the right approach to call in the page data and set it as a property on a PageTemplateProperties.cs?

For example, the _LandingPageTemplate.cshtml is superseding the Landing page View (index.cshtml) Fields. While the Landingpage view (index.cshtml) has access to the Landingpageviewmodel where I can call the field of Model.MainContent. I dont have access to that field when using the PageTemplate.

I tried something like this on the properties: public LandingPageViewModel PageData { get; set; } = new LandingPageViewModel();

And then tried accessing @Model.Properties.PageData.MainContent from the _LandingPageTemplate.cshtml but it didnt work.

Or if there is any documentation referencing this too that would be helpul, but I didnt see any. Or if anyone has an example of how I can achieve this, that would be great, thanks!

   Please, sign in to be able to submit a new answer.