November Happy Hour will be moved to Thursday December 5th.

Problem rendering partial view on Layout page

Vote:
 

Hi, I am trying to render meta information on Layout page by returning a PartialView.

These are parts of my pages.

Layout page:

<head>@{ Html.RenderAction("RenderMeta", "Seo"); }</head>

public class SeoController : PartialContentController<IContentData>
{
public ActionResult RenderMeta(SitePageData currentPage)

{
if (currentPage != null)
{
SeoViewModel viewModel = Mapper.Map<ISeoPage, SeoViewModel>(currentPage);

return PartialView("RenderMeta", viewModel);
}

return null;
}
}

where SitePageData : PageData, ISeoInfo

My problem is that RenderMeta is called, but currentPage is null. I am not sure if this is correct SeoController : PartialContentController<IContentData> and if this is correct RenderMeta(SitePageData currentPage)

I can't find any documentation on how to use PartialContentController.

#64128
Dec 11, 2012 11:30
Vote:
 

I've also not been able to get model binding for content to work for partials. You can however retrieve the ContentReference using:

Request.RequestContext.GetContentLink()

    

#64136
Dec 11, 2012 12:29
Vote:
 

Thx a lot, Joel, this works as expected.

#64186
Dec 12, 2012 13:14
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.