Quantcast
Channel: Optimizely Search & Navigation
Viewing all articles
Browse latest Browse all 6894

Render a page via PageReference

$
0
0

Hello guys,

i am trying to make the page rendered that is a part of other page via a PageReference property. Can't make it work. So, I have:

public virtual PageReference TopNewsContentPage { getset; }  - in startPage

- created an instance of a page that will be used to fill the 'TopNewsContentPage' property in startPage.

Here is the controller and the view for that 'subpage' - partial:

public class AirSimplePageController : PartialContentController<AirSimplePage>   {       public AirSimplePageController(IContentLoader contentLoader)       {       }       [ContentOutputCache(CacheProfile = "AirContentOutputCache")]       public override ActionResult Index(AirSimplePage currentPage)       {           return PartialView(currentPage);       }   }

View:
<div class="">    @Html.PropertyFor(x => x.MainBody, new { CssClass = "no-gutter" })</div>

- and the call to render 'subpage' from within the view of homePage:
@Html.PropertyFor(m => m.CurrentPage.TopNewsContentPage)

In the end I just have one line - name of the that partial page rendered on hopePage. Nothing else. No content of the partial page.

By the way the Index method of the partial page is never being hit.

Any advice how to make that partial page to be displayed within the main page?

thank you


Viewing all articles
Browse latest Browse all 6894

Trending Articles